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.
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!
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.