[GENERAL] Re: GMT FATAL: remaining connection slots are reserved fornon-replication superuser connections, but I'm using pgBouncer forconnection pooling - Mailing list pgsql-general

From Lisandro
Subject [GENERAL] Re: GMT FATAL: remaining connection slots are reserved fornon-replication superuser connections, but I'm using pgBouncer forconnection pooling
Date
Msg-id 1488301254469-5946827.post@n3.nabble.com
Whole thread Raw
In response to Re: [GENERAL] GMT FATAL: remaining connection slots are reserved fornon-replication superuser connections, but I'm using pgBouncer for connection pooling  (Steve Crawford <scrawford@pinpointresearch.com>)
Responses Re: [GENERAL] Re: GMT FATAL: remaining connection slots are reservedfor non-replication superuser connections, but I'm using pgBouncer forconnection pooling  (Scott Marlowe <scott.marlowe@gmail.com>)
List pgsql-general
Hi Steve, thanks for your help.
Your comment made me realise that maybe the problem is my pgBouncer
configuration, specifically default_pool_size. It took me a while to
understand pgbouncer, and I still had some doubts when I configured it.  Now
I undesrtand better.

I connect to all databases with the same user. However, I had set
default_pool_size=10. So with more than 150 databases, it was very probable
that postgresql reach max_connections=250 limit.

I didn't have set reserve_pool_timeout or max_db_connections, but docs say
their default values are reserve_pool_timeout=5 seconds,
max_db_connections=unlimited.

I've reviewed pgBouncer configuration and did some search. I've found this
thread where the first person that responds gives a great explanation abount
how pgbouncer do its maths:
https://github.com/pgbouncer/pgbouncer/issues/174

So, what I did for now was to set this in pgbouncer configuration:
default_pool_size=1
min_pool_size = 0
server_idle_timeout = 30
reserve_pool_size = 10
reserve_pool_timeout = 5
max_db_connections = 5


I'll keep monitoring with this setup, but I can already tell you that the
total number of connections in postgres has significantly reduced (from ~100
to ~60). So I guess the problem was a bad setup of pgbouncer.

Thank you all for your help!



--
View this message in context:
http://www.postgresql-archive.org/GMT-FATAL-remaining-connection-slots-are-reserved-for-non-replication-superuser-connections-but-I-m-g-tp5946245p5946827.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.


pgsql-general by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: [GENERAL] Making a unique constraint deferrable?
Next
From: "David G. Johnston"
Date:
Subject: Re: [GENERAL] Making a unique constraint deferrable?