On 23 September 2012 05:50, Satoshi Nagayasu <snaga@uptime.jp> wrote:
> I have just written the first PoC code to enable load balancing
> in the libpq library.
>
> This libpq enhancement is intended to allow PostgreSQL users to
> take advantage of the replication in easier way.
>
> With using this patch, PQconnectdb() function accepts multiple
> connection info strings, and pick one of them by round-robin basis
> to connect.
It's certainly worth thinking about. New ideas are good, if they have
some justification.
A load balancing solution that only works at connection level isn't
much of a solution, IMHO.
If you have multiple connection strings in the client program, its
trivial to put them in an array and pick one randomly, then use that.
So this is already available as a solution in user space.
Also, any client based solution presumes we can ship lists of cluster
metadata to clients, which we have no solution for, so it places a
much greater burden on the administrator. Load balancing config needs
to be held more centrally.
-- Simon Riggs http://www.2ndQuadrant.com/PostgreSQL Development, 24x7 Support, Training & Services