Re: performance problem of Failover Datasource?

From: Chen Huajun <chenhj(at)cn(dot)fujitsu(dot)com>
To: List <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: performance problem of Failover Datasource?
Date: 2012-12-24 10:26:29
Message-ID: 50D82DD5.5020903@cn.fujitsu.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

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

Attachment Content-Type Size
pgjdbc_failover_loadbalance_for_mutihosts.patch text/plain 28.6 KB
MutiHostsConnectionTest.java text/java 10.6 KB

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Scott Harrington 2012-12-24 20:10:54 Re: performance problem of Failover Datasource?
Previous Message Tom Lane 2012-12-21 20:17:06 Re: [JDBC] BUG #7766: Running a DML statement that affects more than 4 billion rows results in an exception