OPS0007: Application cannot create new database connections
Pega Predictive Diagnostic Cloud™ (PDC) generates the OPS0007 event when new database connections are unavailable for an application.
Reason for the event
When an application cannot establish a new connection to the PostgreSQL database system, Pega Platform™ generates a FATAL: remaining connection slots are reserved for non-replication superuser connections exception. To track this exception PDC generates an OPS0007 event, and creates a unique DBConnections- case for each database for which the exception occurs.
The exception occurs when all available database connections are in use, for example, because an application is using too many resources, because the database system does not have enough resources, or because nodes that do not exist anymore are occupying some of the available connections. The following circumstances might cause this exception:
- An application has multiple connection pools that point to the same database instance.
- Multiple nodes point to the same database, which makes it difficult to identify the correct maximum size of a connection pool. This scenario is common with horizontally scaling cloud applications that can add nodes on demand.
- Multiple applications use the same database instance.
To learn more about the reasons and circumstances behind OPS0007 and related events, see OPS0007: Causes and PDC use case PEGA0026, OPS0020, OPS0007: Objective and background.
Example message text
FATAL: remaining connection slots are reserved for non-replication superuser connections
Database-General Problem encountered when getting connection for database pegarules
Recommended next steps
To resolve OPS0007 issues, perform the following steps:
Check which queries are running and whether any database deadlocks have occurred. Engage a database expert to determine whether the database is locking up due to an unusual query, or the current connection limit is too low. Use the PostgreSQL commands
select current_setting('max_connections')to specifically identify the current limit.
Increasing the size of the connection pool without first considering the optimal database load threshold is a typical cause of connection pool wait times. Even though this might be a temporary solution, database performance is likely to deteriorate due to the increase of load that a larger pool causes. Usually, the root cause of the issue is not an insufficient number of connections, but threads that occupy a connection for an excessive amount of time. To provide a long-term solution, identify and fix slow database queries in your application and optimize the connection pool size.