How Can I Resolve the Issue with PostgreSQL when the Error is Shown in the Logs: "53300: sorry, too many clients already"?
This issue occurs with the error "53300: sorry, too many clients already" in the logs when using the PostgreSQL database when the maximum number of concurrent connections is reached (100 by default) in the database settings.
The Ekran System Application Server opens a new connection to the PostgreSQL database whenever an Ekran System Client comes online. Furthermore, whenever the Ekran System Client starts a new live session, either an additional new connection is opened for it, or the system uses the existing connection that was opened when the Ekran System Client came online (as determined by the database management system).
If an Ekran System Client is online but not currently sending any session data (for any one of a variety of possible reasons), an existing connection may either be closed, or remain open to be used for any possible future requests to the database (i.e. either for when a new Client comes online, or for when a manual request is made to the database by using the Management Tool, such as when opening the Audit log, generating reports, viewing a live session or session for previous days, etc). All manual requests (i.e. from the Management Tool to the database) can use one single connection for all of them.
For terminal servers, the system will open one connection whenever the Ekran System Client installed on the terminal server comes online, as well as open new additional connections for each individual user that logs in (i.e. whenever a new session starts).
To resolve this issue, change the value in the DB settings, by doing the following:
1) Stop the EkranServer service.
2) On the machine where the PostgreSQL database is installed, open the main folder which by default is:
3) In this folder, open the postgresql.conf file, and modify the max_connections value by replacing the default value of "100" with a higher value (e.g. replace it with a value of "1000").
NOTE: Before closing the postgresql.conf file, we also recommend configuring the PostgreSQL database correctly to optimize it for maximum performance using the following article: Configuring the PostgreSQL Database to Optimize it for Maximum Performance.
. 4) Save and close the file.
5) Restart the PostgresSQL service in Windows Services.
6) Restart the EkranServer service.
To check the actual size of the database or any of its tables, the following commands can be used:
• To view the size of the database in a readable format: SELECT pg_size_pretty( pg_database_size('ekranactivitydb') )
• To view the size of a database table in a readable format: SELECT pg_size_pretty( pg_total_relation_size('dbo."SESSIONS"') )