Re: Postgres 9.0 Streaming Replication and Load Balancing?

Lists: pgsql-general
From: Paulo Correia <paulo(dot)correia(at)pdmfc(dot)com>
To: pgsql <pgsql-general(at)postgresql(dot)org>
Subject: Postgres 9.0 Streaming Replication and Load Balancing?
Date: 2012-04-13 13:38:15
Message-ID: 4F882C47.8020800@pdmfc.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Hi!

I have a Postgres 9.0 on CentOs 5.6 with a functional asynchronous
streaming replication to a hot-standby slave (over a TCP connection).

At the moment, the slave only makes the replication, but it accepts
read-only queries.

I need to load-balance the DB requests to both servers and was trying
pgPool-II but it seems it has some problems if we already have
connection pooling elsewhere.
I have some application servers that already have their own connection
pool functionalities and I wonder if anyone found a solution for that.

Imagine I have some different deploys on a Glassfish or a Tomcat server,
using the server connection pooling facilities and from that we would
access the database, or the balancer.

Has anyone managed to do this with pgPool-II? Any other options?

Best regards,
Paulo Correia


From: Paulo Correia <paulo(dot)correia(at)pdmfc(dot)com>
To: pgsql <pgsql-general(at)postgresql(dot)org>
Subject: Re: Postgres 9.0 Streaming Replication and Load Balancing?
Date: 2012-05-14 16:28:07
Message-ID: 4FB13297.5000500@pdmfc.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Hello all!

Still haven't found any solution to this problem.

Having a Postgres 9.0 with assynchronous streaming replication to a
hot-standby slave, both with CentOs 5.6, how can I use both DB instances
for query load balancing?
I've tried with pgPool-II but the pooling mechanism is disruptive with
the existing pool on the application servers.

Has anyone had this issue before? Any suggestions?

Best regards,
Paulo Correia

On 13/04/12 14:38, Paulo Correia wrote:
> Hi!
>
> I have a Postgres 9.0 on CentOs 5.6 with a functional asynchronous
> streaming replication to a hot-standby slave (over a TCP connection).
>
> At the moment, the slave only makes the replication, but it accepts
> read-only queries.
>
> I need to load-balance the DB requests to both servers and was trying
> pgPool-II but it seems it has some problems if we already have
> connection pooling elsewhere.
> I have some application servers that already have their own connection
> pool functionalities and I wonder if anyone found a solution for that.
>
> Imagine I have some different deploys on a Glassfish or a Tomcat
> server, using the server connection pooling facilities and from that
> we would access the database, or the balancer.
>
> Has anyone managed to do this with pgPool-II? Any other options?
>
> Best regards,
> Paulo Correia
>
>


From: Sumit Raja <sumit(dot)raja(at)raja-consulting(dot)co(dot)uk>
To: pgsql <pgsql-general(at)postgresql(dot)org>
Subject: Re: Postgres 9.0 Streaming Replication and Load Balancing?
Date: 2012-05-15 08:01:28
Message-ID: CAB4mO2czCn50Xy19XDkO+Wa=Nm+TknhqjAUE5G1dFfnM3Fv9Bg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

On 14 May 2012 17:28, Paulo Correia <paulo(dot)correia(at)pdmfc(dot)com> wrote:
> Hello all!

> Having a Postgres 9.0 with assynchronous streaming replication to a
> hot-standby slave, both with CentOs 5.6, how can I use both DB instances for
> query load balancing?
> I've tried with pgPool-II but the pooling mechanism is disruptive with the
> existing pool on the application servers.

Is the application RW or read only? What is the disruption being
caused? Are you seeing specific exceptions?

- Sumit


From: Paulo Correia <paulo(dot)correia(at)pdmfc(dot)com>
To: pgsql <pgsql-general(at)postgresql(dot)org>
Subject: Re: Postgres 9.0 Streaming Replication and Load Balancing?
Date: 2012-05-16 15:34:31
Message-ID: 4FB3C907.8070700@pdmfc.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Hello Sumit,

At the given point there are no exceptions since the tests for using
pgPool-II with the application using a master and a slave resulted in
all connections being done on the master and none on the slave.

As the application as it's own connection pool, eventually all
connections will have a RW operation and as so all these connections
will be linked to the master.

As so, I cannot benefit from load balancing since all my connections
will be redirected to the master by pgPool-II, even if they are RO.

Is it possible to have pgPool-II making only load balance with no
connection pool?

Best regards,
Paulo Correia

On 15/05/12 09:01, Sumit Raja wrote:
> On 14 May 2012 17:28, Paulo Correia<paulo(dot)correia(at)pdmfc(dot)com> wrote:
>> Hello all!
>> Having a Postgres 9.0 with assynchronous streaming replication to a
>> hot-standby slave, both with CentOs 5.6, how can I use both DB instances for
>> query load balancing?
>> I've tried with pgPool-II but the pooling mechanism is disruptive with the
>> existing pool on the application servers.
> Is the application RW or read only? What is the disruption being
> caused? Are you seeing specific exceptions?
>
> - Sumit
>


From: Sumit Raja <sumit(dot)raja(at)raja-consulting(dot)co(dot)uk>
To: pgsql <pgsql-general(at)postgresql(dot)org>
Subject: Re: Postgres 9.0 Streaming Replication and Load Balancing?
Date: 2012-05-17 08:32:53
Message-ID: CAB4mO2ePXWNXm48wshKbHYt0K-J3aM4NVLnafOiQitxgz+1mMQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Unsure you can achieve this without a read only and a read write
application set up, I've always had RW application servers separate
from RO ones.

You could disable the application connection pool completely and let
pg-pool do the pooling for you (not sure of performance impact, if
any) as the session needs to be terminated after an insert for pg-pool
to load balance correctly (see
http://www.pgpool.net/mediawiki/index.php/FAQ, 5th one down for more
details).

- Sumit

On 16 May 2012 16:34, Paulo Correia <paulo(dot)correia(at)pdmfc(dot)com> wrote:
> Hello Sumit,
>
> At the given point there are no exceptions since the tests for using
> pgPool-II with the application using a master and a slave resulted in all
> connections being done on the master and none on the slave.
>
> As the application as it's own connection pool, eventually all connections
> will have a RW operation and as so all these connections will be linked to
> the master.
>
> As so, I cannot benefit from load balancing since all my connections will be
> redirected to the master by pgPool-II, even if they are RO.
>
> Is it possible to have pgPool-II making only load balance with no connection
> pool?
>
> Best regards,
> Paulo Correia
>
> On 15/05/12 09:01, Sumit Raja wrote:
>>
>> On 14 May 2012 17:28, Paulo Correia<paulo(dot)correia(at)pdmfc(dot)com>  wrote:
>>>
>>> Hello all!
>>> Having a Postgres 9.0 with assynchronous streaming replication to a
>>> hot-standby slave, both with CentOs 5.6, how can I use both DB instances
>>> for
>>> query load balancing?
>>> I've tried with pgPool-II but the pooling mechanism is disruptive with
>>> the
>>> existing pool on the application servers.
>>
>> Is the application RW or read only? What is the disruption being
>> caused? Are you seeing specific exceptions?
>>
>> - Sumit
>>
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general

--
Raja Consulting Ltd.
Incorporated in England and Wales No. 06454814,  Registered Office: 4
Calder Court, Shorebury Point, Amy Johnson Way, Blackpool FY4 2RH


From: Paulo Correia <paulo(dot)correia(at)pdmfc(dot)com>
To: pgsql <pgsql-general(at)postgresql(dot)org>
Subject: Re: Postgres 9.0 Streaming Replication and Load Balancing?
Date: 2012-05-17 15:10:17
Message-ID: 4FB514D9.4040403@pdmfc.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Yes, that was the results of our tests ...

It seems we'll have to do a lot of work on the application to separate
the queries in order to achieve the load-balancing.

Thanks anyway,

Best regards,
Paulo Correia

On 17/05/12 09:32, Sumit Raja wrote:
> Unsure you can achieve this without a read only and a read write
> application set up, I've always had RW application servers separate
> from RO ones.
>
> You could disable the application connection pool completely and let
> pg-pool do the pooling for you (not sure of performance impact, if
> any) as the session needs to be terminated after an insert for pg-pool
> to load balance correctly (see
> http://www.pgpool.net/mediawiki/index.php/FAQ, 5th one down for more
> details).
>
> - Sumit
>
>
> On 16 May 2012 16:34, Paulo Correia<paulo(dot)correia(at)pdmfc(dot)com> wrote:
>> Hello Sumit,
>>
>> At the given point there are no exceptions since the tests for using
>> pgPool-II with the application using a master and a slave resulted in all
>> connections being done on the master and none on the slave.
>>
>> As the application as it's own connection pool, eventually all connections
>> will have a RW operation and as so all these connections will be linked to
>> the master.
>>
>> As so, I cannot benefit from load balancing since all my connections will be
>> redirected to the master by pgPool-II, even if they are RO.
>>
>> Is it possible to have pgPool-II making only load balance with no connection
>> pool?
>>
>> Best regards,
>> Paulo Correia
>>
>> On 15/05/12 09:01, Sumit Raja wrote:
>>> On 14 May 2012 17:28, Paulo Correia<paulo(dot)correia(at)pdmfc(dot)com> wrote:
>>>> Hello all!
>>>> Having a Postgres 9.0 with assynchronous streaming replication to a
>>>> hot-standby slave, both with CentOs 5.6, how can I use both DB instances
>>>> for
>>>> query load balancing?
>>>> I've tried with pgPool-II but the pooling mechanism is disruptive with
>>>> the
>>>> existing pool on the application servers.
>>> Is the application RW or read only? What is the disruption being
>>> caused? Are you seeing specific exceptions?
>>>
>>> - Sumit
>>>
>>
>> --
>> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
>> To make changes to your subscription:
>> http://www.postgresql.org/mailpref/pgsql-general
>
>