I am seing those errors in cloud sql Postgres logs.
Its a small 1 cpu, 4Gb of ram instance yet this is a bit troublesome.
I do not see any max_connections
in the customizable flags that could allow me to bypass this error.
The app is a simple Django service with very little queries and load not even exposed to the public.
The immediate solution is for me to start using db connection pooling with pgbouncer or a Django app but that adds up a bit of complexity.
max_connections
-----------------
100
Do we have a way to increase this number?
PS: After digging a bit it seems to come from the use of gevent workers with gunicorn. It was stable < 20 connections before that.
Nevertheless, in case of traffic surge it would be good to know if max_connections
can be controlled.
What causes PostgreSQL “Remaining connection slots are reserved” error? psql: FATAL: remaining connection slots are reserved for non-replication superuser connections Basically, Insufficient connections allocated for PostgreSQL tasks causes the issue. Check what your database max connection is. By default, this value is set to 100.
psql: FATAL: remaining connection slots are reserved for non-replication superuser connections Basically, Insufficient connections allocated for PostgreSQL tasks causes the issue. Check what your database max connection is. By default, this value is set to 100. To do this execute any one of the queries below against a database within your cluster:
You are getting this error because your server exceeded the limit of max_connections parameter.max_connection. Decrease the value of [superuser_reserved_connections] parameter: You can find above both parameters in postgresql.conf file. Note: After changing parameters, you must restart the PostgreSQL cluster.
Each PostgreSQL cluster allows 25 backend connections per 1 GB of RAM minus 3 connections per node that are reserved for maintenance. Here is a quick overview of the allowed backend connections based on each plan:
Update: now you can set the max_connections setting via Cloud SQL Flags. See https://cloud.google.com/sql/docs/postgres/flags#postgres-m
There is currently no way to increase a limit, but we are aware of this problem. Please follow Issue 37271935 on our issue tracker.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With