Why standby.max_connections must be higher than primary.max_connections?
Why standby.max_connections must be higher than primary.max_connections?
От:
山田聡 <satoshi.yamada.pg@gmail.com>
Дата:
Hello hackers. I am struggling to understand why standby.max_connections must be higher than primary.max_connections.Do someone know the reason why? I know that standby cluster can not start if standby.max_connections is higher than primary.max_connections. http://www.postgresql.org/docs/9.3/static/hot-standby.html ------- The setting of some parameters on the standby will need reconfiguration if they have been changed on the primary. For these parameters, the value on the standby must be equal to or greater than the value on the primary. If these parameters are not set high enough then the standby will refuse to start. Higher values can then be supplied and the server restarted to begin recovery again. These parameters are: max_connections max_prepared_transactions max_locks_per_transaction ------- I've also read src/backend/access/transam/xlog.c. But there are no comments about a reason. (I cannot find the reason,why standby.max_connections must be higher than primary.max_connections.) 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. thanks & regards
Re: Why standby.max_connections must be higher than primary.max_connections?
От:
Robert Haas <robertmhaas@gmail.com>
Дата:
On Tue, Dec 10, 2013 at 3:34 AM, 山田聡 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
Re: Why standby.max_connections must be higher than primary.max_connections?
От:
satoshi yamada <satoshi.yamada.pg@gmail.com>
Дата:
>> 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.
>>
>> 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@gmail.com>
On Tue, Dec 10, 2013 at 3:34 AM, 山田聡 <satoshi.yamada.pg@gmail.com> wrote:Because the KnownAssignedXIDs and lock tables on the standby need to
> Hello hackers.
>
> I am struggling to understand why standby.max_connections must be higher
> than
> primary.max_connections.Do someone know the reason why?
be large enough to contain the largest snapshot and greatest number of
AccessExclusiveLocks that could exist on the master at any given time.Your load balancer should probably have a configuration setting that
> 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.
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
Re: Why standby.max_connections must be higher than primary.max_connections?
От:
Peter Geoghegan <pg@heroku.com>
Дата:
On Tue, Dec 10, 2013 at 1:17 PM, Robert Haas wrote: > 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. Right. Initially during the development of Hot Standby, it looked like the "max_connections >= master's" requirement on standbys wasn't going to be necessary, or could be avoided. However, Simon gave up on that idea on pragmatic grounds here: http://www.postgresql.org/message-id/1252002165.2889.467.camel@ebony.2ndQuadrant I'd thought about revisiting this myself, but I think that the impetus to do so is lessened by recent work on logical replication. -- Peter Geoghegan
Re: Why standby.max_connections must be higher than primary.max_connections?
От:
satoshi yamada <satoshi.yamada.pg@gmail.com>
Дата:
>> 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.
>
> Right. Initially during the development of Hot Standby, it looked like
> the "max_connections >= master's" requirement on standbys wasn't going
> to be necessary, or could be avoided. However, Simon gave up on that
> idea on pragmatic grounds here:
>
> http://www.postgresql.org/message-id/1252002165.2889.467.camel@ebony.2ndQuadrant
>
> I'd thought about revisiting this myself, but I think that the impetus
> to do so is lessened by recent work on logical replication.
>
Hi Peter
Your information make my question be clearly.
I understand the discussions about this restriction.
Thanks.
>> be large enough to contain the largest snapshot and greatest number of
>> AccessExclusiveLocks that could exist on the master at any given time.
>
> Right. Initially during the development of Hot Standby, it looked like
> the "max_connections >= master's" requirement on standbys wasn't going
> to be necessary, or could be avoided. However, Simon gave up on that
> idea on pragmatic grounds here:
>
> http://www.postgresql.org/message-id/1252002165.2889.467.camel@ebony.2ndQuadrant
>
> I'd thought about revisiting this myself, but I think that the impetus
> to do so is lessened by recent work on logical replication.
>
Hi Peter
Your information make my question be clearly.
I understand the discussions about this restriction.
Thanks.
2013/12/12 Peter Geoghegan <pg@heroku.com>
On Tue, Dec 10, 2013 at 1:17 PM, Robert Haas <robertmhaas@gmail.com> wrote:Right. Initially during the development of Hot Standby, it looked like
> 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.
the "max_connections >= master's" requirement on standbys wasn't going
to be necessary, or could be avoided. However, Simon gave up on that
idea on pragmatic grounds here:
http://www.postgresql.org/message-id/1252002165.2889.467.camel@ebony.2ndQuadrant
I'd thought about revisiting this myself, but I think that the impetus
to do so is lessened by recent work on logical replication.
--
Peter Geoghegan