Re: FATAL: remaining connection slots are reserved for non-replication superuser connections

From: Steve Crawford <scrawford(at)pinpointresearch(dot)com>
To: Patrick B <patrickbakerbr(at)gmail(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: FATAL: remaining connection slots are reserved for non-replication superuser connections
Date: 2017-02-08 03:15:39
Message-ID: CAEfWYyxAOiedbieJPgii1mM8ggxPN7PkXC+quOYfKF7JCEjjGQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Feb 7, 2017 at 6:52 PM, Patrick B <patrickbakerbr(at)gmail(dot)com> wrote:

> Hi guys,
>
> I get these messages at least once a day in my Prod environment:
>
>> FATAL: remaining connection slots are reserved for non-replication
>> superuser connections
>
> I do not have a DB pooler and my max_connections is 200. However, max
> connections for my PHP Application is 120.
>
> My server has 128GB and SSD 10K iops disks (Amazon EBS).
>
>
> Can you guys please outlines me the steps to troubleshoot this?
>
> Interesting is that I didn't see any IO/CPU limitation on my server.
>
> I'm currently running a Postgres 9.2 - one master and one slave streaming
> replication.
>
>
> Thanks
>
> Patrick
>

Something is using too many connections.

I may be wrong but I'm unaware of a limit on connections from PHP except
when you are using persistent connections. Since each PHP script is it's
own process, it can create one or more connections. I'd check to be sure
that every PHP script you have is, indeed, using pg_pconnect and not
pg_connect. That missing "p" could be hard to spot. I'm assuming, of
course, that you are sure that your PHP script are the only things that can
connect - no scripts, backups, etc. are consuming connections.

But generally I'd advise using pg_bouncer or a similar pooler which can
deal with a mix of connections from persistent and non-persistent
connections from one or multiple hosts.

Cheers,
Steve

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tatsuo Ishii 2017-02-08 03:27:29 Re: FATAL: remaining connection slots are reserved for non-replication superuser connections
Previous Message Patrick B 2017-02-08 02:52:16 FATAL: remaining connection slots are reserved for non-replication superuser connections