Hi,
I'm facing "Too many clients already" error frequently with my PostgreSQL (v9.6.5) container (i.e. being used along with CKAN application i.e. A open source data management system ), I have observed that PostgreSQL is not releasing IDLE connections from their end. I have set "max_connetions = 100" in postgresql.
It is the responsibility of the client software to release
connections when they are no longer needed. The server won't just
time-out idle connections unless it is told to do so
I guess CKAN is keeping a pool of available connections that it
can reuse without having to start a new connection. You may be
able to set parameters in CKAN so that it kills connections after
they have been idle a while. If you're not sure, you really need
to ask on a CKAN support forum
Or you could use a separate connection pooler (eg PgBouncer) and
have CKAN connect to that instead of the database directly. The
pooler will then manage reuse across all the client applications,
and may be able to timeout idle connections for you.
-- Paul Paul Smith Computer Services support@xxxxxxxxxx - 01484 855800