All Products
Search
Document Center

ApsaraDB RDS:Modify maximum connections

Last Updated:Jun 22, 2026

Adjust the maximum number of connections for an ApsaraDB RDS for MySQL instance to meet high-concurrency workload demands.

Background

ApsaraDB RDS for MySQL allows you to modify the parameters that control maximum connections. You can change these parameters in the ApsaraDB RDS console or by calling an API operation.

Use cases

Adjust the maximum connections when your workload changes significantly. For example, gaming applications that use short-lived connections may experience a surge in connection requests during a service launch or version update.

Parameters

The following two parameters control the maximum connections:

  • max_user_connections: The maximum number of simultaneous connections allowed for a single database account. The value can range from 10 to 208,000. If the number of connections for an account exceeds this limit, the system returns a has more than 'max_user_connections' or has exceeded the 'max_user_connections' error, and new connections are blocked.

  • max_connections: The maximum number of simultaneous connections allowed to the instance across all database accounts. The value can range from 1 to 208,000. If the total number of connections exceeds this limit, the system returns a too many connections error, and new connections are blocked.

Impact

Each connection consumes memory. Setting max_connections too high may cause out of memory (OOM) errors. Use the default value for your instance type to prevent stability issues when the configured connection limit exceeds the instance's capacity.

Usage notes

  • After you modify the max_connections parameter, the value in the Running Value column on the Parameters page is higher than the value you set. This is because the displayed value includes connections reserved by the system for maintenance. The Maximum Connections value on the Basic Information page is the same as the value that you set.

  • After an instance restarts, the upper limit of the max_connections parameter is affected by the open_files_limit parameter. In this case, the actual running value of max_connections is determined by the following formula: min(open_files_limit - 810, your specified value or the recommended maximum connections for the current instance type + reserved maintenance connections).

    The default value of open_files_limit is 655350. If you set the max_connections parameter to a value greater than 654540 (including reserved maintenance connections), also increase the open_files_limit parameter in the console to prevent max_connections from being capped by open_files_limit after an instance restart. The open_files_limit parameter is a static parameter, meaning you must restart the instance for a change to take effect.

Modify maximum connections in the console

  1. Go to the Instances page. In the top navigation bar, select the instance's region, and then click the instance ID.

  2. In the left-side navigation pane, click Parameters.

  3. On the Modifiable Parameters tab, find the max_user_connections or max_connections parameter. In the Running Value column, click the image icon, enter a new value in the dialog box, and then click OK.

  4. Click Apply Changes. In the dialog box that appears, select when the changes take effect, and then click OK.

    Note

    Changes to the max_user_connections and max_connections parameters take effect immediately without an instance restart.

Modify maximum connections by API

Request example

This example uses the ModifyParameter API operation to set max_connections to 2000 and max_user_connections to 500.

http(s)://rds.aliyuncs.com/?Action=ModifyParameter
&DBInstanceId=rm-gs5v9xajylz45****
&Parameters={"max_connections":"2000","max_user_connections":"500"}
&<common request parameters>

Sample response in JSON format

HTTP/1.1 200 OK
Content-Type:application/json
{
  "RequestId" : "542BB8D6-4268-45CC-A557-B03EFD7AB30A"
  } 

Verify the change

  1. Go to the Instances page. In the top navigation bar, select the instance's region, and then click the instance ID.

  2. In the left-side navigation pane, click Parameters.

  3. On the Edit History tab, verify that the new parameter values have taken effect.

FAQ

  • Q: Before I modified the max_connections parameter, why was the value in the Running Value column on the Parameters page already higher than the actual maximum available connections for my instance?

    A: The value in the Running Value column on the Parameters page includes connections reserved for instance maintenance and stability, which is why it is higher than the number of connections available to your applications.

  • Q: After I modified the max_connections parameter, why is the Running Value greater than the value I set?

    A: The value in the Running Value column on the Parameters page includes connections reserved for instance maintenance and stability. The actual maximum number of connections available to your applications appears in the Maximum Connections field on the Basic Information page.

  • Q: Why did the maximum connections not change after I upgraded the instance type?

    A: The maximum connections can be set manually. If you have not set a custom value, the instance uses a default value based on its instance type.