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

Dear community experts,

We have 7 dhis2 running on a lxc based installation (postgres 13). We have 256GB Ram.

We are very often getting FATAL: remaining connection slots are reserved for non-replication superuser connections these days.

We have seen an old post from 2014 around the same topic so we tried max_connections = 1000 in postgres conf, just to test it out, still we get this error very often.

Do you have any suggestions on fine-tuning this configuration.

Hi @jthomas

Your question really needs a server expert to respond to this, but I also expect that they will ask you for further information. Let’s see if we get a response. Thanks!

1 Like

Hi Jins

I gather you have 7 instances running against one postgresql database container. That is quite a lot (depending on how busy they are). For a busy, or badly behaved, dhis2 instance it can be more manageable to give it its own postgresql container to work with.

Anyway you should not be getting the error message you are unless the sum of all the max connection pool sizes of your instances exceeds the max_connections of your database server. Can you check what you have configured in dhis.conf for each of your instances and verify the above?

If you have munin configured you should also be able to get an idea of how the postgresql connections are being used.

Regards
Bob

3 Likes

Dear @bobj i missed your valuable message. I see so you reccomend having more than one postgres containers based on number of instances.

In dhis.conf we didn’t configure any max connections, so by default will it take upto 40? should we think of reducing it?

We have munin and here are some screenshots

image