Symptoms
When logging in to POA/PBA or switching between them, the following error message is displayed:
Error [unixODBC]FATAL: remaining connection slots are reserved for non-replication superuser connections
The periodic task 'Synchronize resource usage for instances of APS applications' runs every 5 minutes and often fails with the error message above.
POA database demonstrates many waiting queries to update APS related tables and the 'aps_resource_usage_report' table in particular:
plesk=# SELECT current_query FROM pg_stat_activity; current_query ----------------------- <IDLE> in transaction UPDATE "aps_resource_usage_report" SET "last_update_timestamp" = ('1375866990'), "poll_interval" = (0) WHERE ("aps_resource_usage_report"."id") = (17) UPDATE "aps_resource_usage_report" SET "last_update_timestamp" = ('1375777289'), "poll_interval" = (0) WHERE ("aps_resource_usage_report"."id") = (11) plesk=# SELECT count(*) FROM pg_stat_activity WHERE current_query LIKE '%aps_resource_usage_report%'; count ------- 249 (1 row)
Cause
Frequent execution of the APS resource synchronization task leads to high load on the POA system database and connections to database are exhausted as the result.
Resolution
Increase period of the periodic task 'Synchronize resource usage for instances of APS applications' e.g. to 1 hour or more to reduce database load.
Increase amount of connections to the POA system database:
- Log into the PostgreSQL server where the POA database s running as root
- Increase the value of the 'max_connections' parameter in the '/var/lib/pgsql/9.0/data/postgresql.conf' file from the default 100 to e.g. 200 or more
Restart the POA and the PostgreSQL services using the following commands on the proper servers (POA Management Node and POA database server):
/etc/init.d/pem stop
/etc/init.d/postgresql-9.0 stop
/etc/init.d/postgresql-9.0 start
/etc/init.d/pem start