Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1Tn5GI-0004Zb-Nx for pgsql-jdbc@arkaria.postgresql.org; Mon, 24 Dec 2012 10:27:59 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1Tn5GI-000843-8L for pgsql-jdbc@arkaria.postgresql.org; Mon, 24 Dec 2012 10:27:58 +0000 Received: from makus.postgresql.org ([98.129.198.125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1Tn5GG-00083y-Is for pgsql-jdbc@postgresql.org; Mon, 24 Dec 2012 10:27:57 +0000 Received: from [222.73.24.84] (helo=song.cn.fujitsu.com) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1Tn5GA-0007cS-JF for pgsql-jdbc@postgresql.org; Mon, 24 Dec 2012 10:27:55 +0000 X-IronPort-AV: E=Sophos;i="4.84,346,1355068800"; d="java'?scan'208";a="6463653" Received: from unknown (HELO tang.cn.fujitsu.com) ([10.167.250.3]) by song.cn.fujitsu.com with ESMTP; 24 Dec 2012 18:25:48 +0800 Received: from fnstmail02.fnst.cn.fujitsu.com (tang.cn.fujitsu.com [127.0.0.1]) by tang.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id qBOARkd5015417 for ; Mon, 24 Dec 2012 18:27:46 +0800 Received: from [10.167.159.99] ([10.167.159.99]) by fnstmail02.fnst.cn.fujitsu.com (Lotus Domino Release 8.5.3) with ESMTP id 2012122418273474-581981 ; Mon, 24 Dec 2012 18:27:34 +0800 Message-ID: <50D82DD5.5020903@cn.fujitsu.com> Date: Mon, 24 Dec 2012 18:26:29 +0800 From: Chen Huajun User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; ja; rv:1.9.2.28) Gecko/20120306 Lightning/1.0b2 Thunderbird/3.1.20 MIME-Version: 1.0 To: List Subject: Re: performance problem of Failover Datasource? References: <4DFA5A86.9030301@acm.org> <4DFA671F.2050005@acm.org> <4DFA9704.4000209@hogranch.com> <4DFAB403.5010309@acm.org> <4DFAB5B8.5010603@hogranch.com> <4DFAB9E2.4070905@acm.org> <1334056170219-5629626.post@n5.nabble.com> <1355303340886-5736270.post@n5.nabble.com> <50C9B102.2060208@cn.fujitsu.com> <50CA959E.4060603@cn.fujitsu.com> <50CB29BD.6090903@cn.fujitsu.com> <50CC2279.3090301@cn.fujitsu.com> <50CFB362.4080701@cn.fujitsu.com> In-Reply-To: <50CFB362.4080701@cn.fujitsu.com> X-MIMETrack: Itemize by SMTP Server on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2012/12/24 18:27:34, Serialize by Router on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2012/12/24 18:27:35 Content-Type: multipart/mixed; boundary="------------070705050609030207070505" X-Host-Lookup-Failed: Reverse DNS lookup failed for 222.73.24.84 (failed) X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-jdbc Precedence: bulk Sender: pgsql-jdbc-owner@postgresql.org --------------070705050609030207070505 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=UTF-8; format=flowed Hi I have made a new patch(with my test). Please give a look. It support the following features 1) performance improve for fail over by avoiding dead hosts. 2) simple load balance by picking up the first host from multiple valid hosts randomly. 3) ability of choosing master or slave to connect to. And in the patch, three connection parameters were added. targetServerType = String Specifies what kind of server to connect.The value should be one of the following: any master slave slavefirst (Try connecting to the slaves first.If failed try the master) The default is 'any'. enableLoadBalance = boolean Enable or disable load balance when multiple hosts were specified;If load balance is enabled,specified multiple hosts will be picked up randomly. The default is false. failedHostCheckPeriod = int Specifies period(seconds) to check whether the failed hosts had been repaired, when load balance is enabled; 0 means never check. The default is 600 seconds. (2012/12/18 8:05), Chen Huajun wrote: > > Thanks for you advise. > I will try to made a new patch and add load balance supporting. > > -- Best Regards, Chen Huajun --------------070705050609030207070505 Content-Type: text/plain; name="pgjdbc_failover_loadbalance_for_mutihosts.patch" Content-Disposition: attachment; filename="pgjdbc_failover_loadbalance_for_mutihosts.patch" Content-Transfer-Encoding: quoted-printable diff --git a/build.xml b/build.xml index c9c5660..e34f85f 100644 --- a/build.xml +++ b/build.xml @@ -132,6 +132,7 @@ + =20