Confluence is displaying pages slowly or showing 503 errors with PostgreSQL
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Problem
Confluence pages are displaying very slowly or users are seeing 503 errors in the browser.
Diagnosis
Environment
- PostgreSQL is used with c3p0 pooling. c3p0 is used in Confluence 7.13 and earlier.
Diagnostic Steps
Check <confluence-home>/confluence.cfg.xml
for the value<property name="hibernate.c3p0.max_size">
. The default is usually 30.When the system is running slow, or showing 503 errors, run the following SQL command where
USER
is the username defined in<confluence-home>/confluence.cfg.xml
for the database connection in<property name="hibernate.connection.username">
:from Linux shellwhile true; do sudo -u postgres psql -c "SELECT count(*) FROM pg_stat_activity where usename = 'USER';"; sleep 5; done
in psqlSELECT count(*) FROM pg_stat_activity where usename = 'USER';
If the
count
is equal to or close tohibernate.c3p0.max_size,
this may indicate there are insufficient database connections.Check the value of
max_connections
inpostgresql.conf
and ensure that it is greater than thehibernate.c3p0.max_size
. See also the PostgeSQL documentation on tuning. The default is usually 100.postgresql.confmax_connections = 100
Cause
The c3p0 database connection pool is running out of connections and causing timeouts when accessing the database.
Resolution
Increase the value of
hibernate.c3p0.max_size in <confluence-home>/confluence.cfg.xml
and restart Confluence.Monitor the connections during peak time using the above script. The value cannot go higher than
max_connections
inpostgresql.conf
.