Re: replication_reserved_connections

From: Atri Sharma <atri(dot)jiit(at)gmail(dot)com>
To: Marko Tiikkaja <marko(at)joh(dot)to>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: replication_reserved_connections
Date: 2013-07-28 06:51:55
Message-ID: 89E40162-DC70-49E5-BEEF-0D2D771D2819@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Sent from my iPad

On 28-Jul-2013, at 5:53, Marko Tiikkaja <marko(at)joh(dot)to> wrote:

> Hi,
>
> Yesterday an interesting scenario was diagnosed on IRC. If you're running a synchronous slave and the connection to the slave is lost momentarily, your backends start naturally waiting for the slave to reconnect. If then your application keeps trying to create new connections, it can use all non-reserved connections, thus locking out the synchronous slave when the connection problem has resolved itself. This brings the entire cluster into a state where manual intervention is necessary.
>
Solving that was fun!

> While you could limit the number of connections for non-replication roles, that's not always possible or desirable. I would like to introduce a way to reserve connection slots for replication. However, it's not clear how this would work. I looked at how superuser_reserved_connections is implented, and with small changes I could see how to implement two ideas:
>
> 1) Reserve a portion of superuser_reserved_connections for replication
> connections. For example, with max_connections=10,
> superuser_reserved_connections=2 and
> replication_reserved_connections=1, at 8 connections either a
> replication connection or a superuser connection can be created,
> and at 9 connections only a superuser one would be allowed. This
> is a bit clumsy as there still aren't guaranteed slots for
> replication.
>

I would generally in agree with sharing super user reserved connections with replication.One thing I would like to explore is if we could potentially add some sort of priority system for avoiding contention between super user threads and replication threads competing for the same connection.

We could potentially add a GUC for specifying which has the higher priority.

I am just musing here,though.

Thanks and Regards,

Atri

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Martijn van Oosterhout 2013-07-28 09:39:40 Re: improve Chinese locale performance
Previous Message David Fetter 2013-07-28 05:49:49 Re: Review: UNNEST (and other functions) WITH ORDINALITY