pg.ddx.io pgsql-jdbc@postgresql.org mailing list archivehelp / color / mirror / Atom feed
From: Craig Ringer <craig@2ndquadrant.com>
To: Scott Harrington <scotth01@sns-usa.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: performance problem of Failover Datasource?
Date: Tue, 18 Dec 2012 08:29:32 +0800
Message-ID: <50CFB8EC.6070402@2ndquadrant.com> (raw)
In-Reply-To: <alpine.WNT.2.00.1212151055200.6544@turks>
References: <4DFA5A86.9030301@acm.org>
<itdn5g$eu7$1@dough.gmane.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>
<CADK3HH+TLPjrrJ=cQWqZ+0B5o96xR+sTVcvqhcDU4CjyryKG2g@mail.gmail.com>
<50CA959E.4060603@cn.fujitsu.com>
<50CB29BD.6090903@cn.fujitsu.com>
<50CC2279.3090301@cn.fujitsu.com>
<alpine.WNT.2.00.1212151055200.6544@turks>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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
--
Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-jdbc
view thread (13+ messages) latest in thread
Message-ID: <50CFB8EC.6070402@2ndquadrant.com> Permalink: ../50CFB8EC.6070402@2ndquadrant.com/ Also on: postgresql.org/message-id/50CFB8EC.6070402@2ndquadrant.com ·
reply
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Reply to all the recipients from your mail client; the link fills in the headers below: reply via email Some clients, webmail especially, drop In-Reply-To and References from a link, and the reply then starts a new thread: use the mbox below. To: pgsql-jdbc@postgresql.org Cc: craig@2ndquadrant.com, scotth01@sns-usa.com Subject: Re: performance problem of Failover Datasource? In-Reply-To: <50CFB8EC.6070402@2ndquadrant.com> References: <4DFA5A86.9030301@acm.org> <itdn5g$eu7$1@dough.gmane.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> <CADK3HH+TLPjrrJ=cQWqZ+0B5o96xR+sTVcvqhcDU4CjyryKG2g@mail.gmail.com> <50CA959E.4060603@cn.fujitsu.com> <50CB29BD.6090903@cn.fujitsu.com> <50CC2279.3090301@cn.fujitsu.com> <alpine.WNT.2.00.1212151055200.6544@turks> <50CFB8EC.6070402@2ndquadrant.com> * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox