
Increasing the max_connections parameter doesn't cause any outage. Set a larger value for the max_connections parameter using a custom instance-level parameter group.You can increase the maximum number of connections to your RDS for MySQL or RDS for PostgresSQL DB instance using the following methods:

You might also consider upgrading to a larger Amazon RDS DB instance class. Tip: It's a best practice to configure only the active connections that are required for application performance. To terminate an idle connection in an RDS for PostgreSQL instance, run the following command: SELECT pg_terminate_backend(example-pid) SELECT * FROM pg_stat_activityĪND state in ('idle', 'idle in transaction', 'idle in transaction (aborted)', 'disabled')ĪND state_change < current_timestamp - INTERVAL '15' MINUTE This query displays information about backend processes with one of the following states for more than 15 minutes: 'idle', 'idle in transaction', 'idle in transaction (aborted)' and 'disabled'. Idle connections: You can view the idle connections in an RDS for PostgreSQL instance by running the following query. To terminate a sleeping connection in an RDS for MySQL DB instance, run the following command: CALL mysql.rds_kill(example-pid)

As a result, when the application server tries to open all client connections to the database, these connections might be refused. If you configure a connection limit that's very high, you might end up with higher memory usage even if those connections aren’t used. Sleeping connections: Sleeping connections that are also known as inactive open connections are caused when you set higher values for connection timeout parameters, such as wait_timeout or interactive_timeout in MySQL. To view the connections for each database for your RDS for PostgreSQL instance, run the following command: SELECT datname, numbackends FROM pg_stat_database
Mysql connection limit full#
To list all active connections for your RDS for MySQL DB instance, run the following command: SHOW FULL PROCESSLIST Over time, these new server connections can cause your instance to exceed the max_connections value. Improperly closing a client or application connection after the end of an operation: When a server connection isn't properly closed, the client application opens up a new connection. Increase in the number of client or application connections to the DB instance: This is caused by an increased workload or table/row-level locking. The following factors might cause your database connections to exceed the max_connections value:


A DB instance class with more available memory supports a larger number of database connections. The default value of max_connections for both RDS for MySQL and RDS for PostgreSQL depends on the instance class used by the Amazon RDS instance. To check the current value for max_connections, run the following command after connecting to your Amazon RDS for PostgreSQL instance: postgres=> show max_connections By default, the max_connections parameter is based on the following formula in Amazon RDS for PostgreSQL (calculated from the DBInstanceClassMemory value): max_connections = LEAST(, 5000) In Amazon RDS for PostgreSQL, the max_connections metric monitors the set maximum number of concurrent connections. To check the current value of max_connections, run the following command after connecting to your Amazon RDS for MySQL instance: SHOW GLOBAL VARIABLES LIKE 'max_connections' In Amazon RDS for MySQL, the max_connections metric monitors the set maximum number of (allowed) simultaneous client connections.īy default, the max_connections parameter is based on the following formula in Amazon RDS for MySQL (calculated from the DBInstanceClassMemory value): max_connections = DBInstanceClassMemory/12582880 Resolution View the current max_connections value
