If excessive connections are established to an ApsaraDB RDS for PostgreSQL instance, clients cannot connect to the RDS instance. You can view the maximum number of connections that are allowed for the RDS instance and close unnecessary connections.
Problem description
The number of connections to an RDS instance reaches the upper limit, and clients cannot connect to the RDS instance. The following error message is displayed:
FATAL: remaining connection slots are reserved for non-replication superuser connections
Solutions
Short-term solution
Close unnecessary connections to your RDS instance.
- Go to the Instances page. In the top navigation bar, select the region in which the RDS instance resides. Then, find the RDS instance and click the ID of the instance.
In the left-side navigation pane, choose Autonomy Services > Diagnostics.
On the page that appears, click the Session Management tab.
On the Session Management tab, view the current session of the RDS instance and use the session management feature to close unnecessary sessions connected to the RDS instance. For more information, see Use the session management feature.
Long-term solution
Find and optimize time-consuming queries to reduce system load and release system resources. For more information, see Use the slow query log analysis feature.
Enable the connection pooling feature of ApsaraDB RDS for PostgreSQL. This feature reduces the impacts caused by frequent connection establishment and closing on instance performance. This feature also helps you manage the load and resource usage of the database server. For more information, see Enable or disable the connection pooling feature.
Use the database proxy feature of ApsaraDB RDS for PostgreSQL. This feature simplifies instance connection management and ensures the high availability, high performance, and maintainability of your database system. This feature is suitable in scenarios in which the primary RDS instance is overloaded, read/write splitting is required, a large number of connections are established, or isolation requirements must be met. For more information, see What are database proxies?
If the number of connections to your RDS instance exceeds the maximum number of connections that is supported by the instance type of the RDS instance due to business requirements and the connection issue cannot be resolved by using the connection pooling and database proxy feature, upgrade the instance type to meet higher connection requirements.
For more information about the maximum number of connections for each instance type, see Instance types for primary ApsaraDB RDS for PostgreSQL instances.
NoteYou can view the specifications of your RDS instance in the Configuration Information section of the Basic Information page.
For more information about how to upgrade instance specifications, see Change instance specifications.
Application scope
ApsaraDB RDS for PostgreSQL