Help Center> Relational Database Service> Troubleshooting> RDS for MySQL> Connection Issues> Error Message "connection established slowly"
Updated on 2023-11-03 GMT+08:00

Error Message "connection established slowly"

Scenario

During peak hours, the connection between a client and an RDS for MySQL instance often times out. As a result, it takes more than 10 seconds to log in to the instance.

Possible Causes

  1. View error logs of the instance to check whether the information "connection xxx is established slowly" is displayed. Example:

    If yes, some connections have timed out and have not been processed by the RDS for MySQL instance yet. When the connection between a client and the instance exceeds the specified timeout duration, an error is reported.

  2. Check the thread pool configuration (enabled by default) on the console.

    In the preceding figure, threadpool_oversubscribe is set to 3. The wait time for the thread pool to process connections is related to this parameter.

Solution

If there are a large number of new connections, increase the value of threadpool_oversubscribe to increase the total number of threads. This reduces the overhead of repeated thread creation and destruction, and limits the number of running threads to protect the system against avalanche.

In normal cases, the thread pool is used when there are a large number of short connections. If persistent connections are used and there are a few connections (for example, the client uses a connection pool), the thread pool is not so helpful. In this case, adjust the value of threadpool_oversubscribe to increase the total number of threads, or close the thread pool.