All Products
Search
Document Center

ApsaraDB for Redis:Specify a timeout period for client connections

Last Updated:Jun 15, 2023

You can set the timeout parameter for an instance to specify a timeout period for connections established between the instance and clients. Then, the system can close client connections that have timed out to recycle resources.

Background information

By default, ApsaraDB for Redis does not close a client connection that stays idle for a long period of time. However, we recommend that you specify the timeout parameter in core applications to allow ApsaraDB for Redis to recycle resources. If resources cannot be recycled in a timely manner after exceptions occur on clients, the connection pool may be filled with idle client connections. This may result in a service crash. Such an issue in core applications may cause serious impacts on your business.

The valid values of the timeout parameter are 0 to 100000. The default value is 0, which indicates that no timeout period is applied. Unit: seconds. To improve performance, ApsaraDB for Redis does not immediately close a client connection when the client connection reaches the timeout value. For example, if the timeout parameter is set to 10 seconds, a client connection may remain idle for more than 10 seconds and be closed when many client connections are established on the server. To reduce latency, you can specify a larger value for the hz parameter to increase the frequency of background tasks that close idle connections.

Procedure

  1. Log on to the ApsaraDB for Redis console and go to the Instances page. In the top navigation bar, select the region in which the instance that you want to manage resides. Then, find the instance and click its ID.
  2. In the left-side navigation pane, click System Parameters.
  3. On the System Parameters page, find the timeout parameter and click Modify in the Actions column.

  4. In the dialog box that appears, change the value of the timeout parameter.

  5. Click OK.

Related operations

OperationDescription
DescribeParametersQueries the configuration and operational parameters of a Tair instance.
ModifyInstanceConfigModifies parameters of a Tair instance.