Re: Why standby.max_connections must be higher than primary.max_connections?

From: satoshi yamada <satoshi(dot)yamada(dot)pg(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Why standby.max_connections must be higher than primary.max_connections?
Date: 2013-12-11 22:46:25
Message-ID: CAAsiBbz24WKOWcPeka-BV8qu+Ood9tVTQYBn3mVh0acx1yo-2Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>> Hello hackers.
>>
>> I am struggling to understand why standby.max_connections must be higher
>> than
>> primary.max_connections.Do someone know the reason why?
>
> Because the KnownAssignedXIDs and lock tables on the standby need to
> be large enough to contain the largest snapshot and greatest number of
> AccessExclusiveLocks that could exist on the master at any given time.
>
>> I think this restriction obstructs making a flexible load balancing.
>> I'd like to make standby database to use load balancing.Of course
>> a role of a standby server is different from one of a master server.
>> So I think it it natural that I want to set standby.max_connections less
>> than
>> primary.max_connections.
>
> Your load balancer should probably have a configuration setting that
> controls how many connections it will try to make to the database, and
> you can set that to a lower value than max_connections.
>
Hi Robert.

I understand the reason Why standby.max_connections must be higher
than primary.max_connections.

I'll try to restrict sessions by load balancer.

Thanks.

2013/12/11 Robert Haas <robertmhaas(at)gmail(dot)com>

> On Tue, Dec 10, 2013 at 3:34 AM, 山田聡 <satoshi(dot)yamada(dot)pg(at)gmail(dot)com> wrote:
> > Hello hackers.
> >
> > I am struggling to understand why standby.max_connections must be higher
> > than
> > primary.max_connections.Do someone know the reason why?
>
> Because the KnownAssignedXIDs and lock tables on the standby need to
> be large enough to contain the largest snapshot and greatest number of
> AccessExclusiveLocks that could exist on the master at any given time.
>
> > I think this restriction obstructs making a flexible load balancing.
> > I'd like to make standby database to use load balancing.Of course
> > a role of a standby server is different from one of a master server.
> > So I think it it natural that I want to set standby.max_connections less
> > than
> > primary.max_connections.
>
> Your load balancer should probably have a configuration setting that
> controls how many connections it will try to make to the database, and
> you can set that to a lower value than max_connections.
>
> --
> Robert Haas
> EnterpriseDB: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Josh Berkus 2013-12-11 22:49:18 Re: ANALYZE sampling is too good
Previous Message Martijn van Oosterhout 2013-12-11 22:39:04 Re: ANALYZE sampling is too good