Re: performance problem of Failover Datasource?

From: Craig Ringer <craig(at)2ndquadrant(dot)com>
To: Scott Harrington <scotth01(at)sns-usa(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: performance problem of Failover Datasource?
Date: 2012-12-18 00:29:32
Message-ID: 50CFB8EC.6070402@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Hudson, Derrick 2012-12-18 14:25:50 Re: JPA + enum == Exception
Previous Message Craig Ringer 2012-12-18 00:20:43 Re: JPA + enum == Exception