Re: performance problem of Failover Datasource? - Mailing list pgsql-jdbc

From Craig Ringer
Subject Re: performance problem of Failover Datasource?
Date
Msg-id 50CFB8EC.6070402@2ndquadrant.com
Whole thread Raw
In response to Re: performance problem of Failover Datasource?  (Scott Harrington <scotth01@sns-usa.com>)
List pgsql-jdbc
On 16/12/2012 12:19 AM, Scott Harrington wrote:
> On Sat, 15 Dec 2012, Chen Huajun wrote:
>
>> In this patch,I use Collections.synchronizedSet to synchronize within
>> multi-threads. But i worry about locking operation is a litter
>> frequent by Collections.synchronizedSet and may affect performance. I
>> think using keword "synchronized" explicitly instead of
>> Collections.synchronizedSet may reduce times of locking.Is there any
>> better suggestion?
>>
>> In addition, I have a idea. By adjusting the order of hosts we also
>> can implement a simple load balance while all of the hosts are master
>> or read only slave. For example: Basically pick up the server
>> randomly.If one server had dead remove it from the candidates, and
>> retry the next server. And after a while(can be configured) re-add
>> the dead host to the candidates because the dead server may had been
>> repaired.
>>
>> What about that?
>
> Perhaps instead you could abstract this logic into a
> org.postgresql.util.HostChooser interface, which would replace the
> HostSpec[] array that currently gets passed around.
There's certainly value to that. We're almost certainly goin to want to
support things like connecting to any slave and asking it "which server
is the master I should connect to" in future, so a way to abstract host
selection would be a big win.

--
Craig Ringer http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services



pgsql-jdbc by date:

Previous
From: Craig Ringer
Date:
Subject: Re: JPA + enum == Exception
Next
From: "Hudson, Derrick"
Date:
Subject: Re: JPA + enum == Exception