All Products
Search
Document Center

Tair (Redis® OSS-Compatible):Adjust the frequency of background tasks

Last Updated:Nov 14, 2024

By changing the value of the hz parameter, you can adjust the frequency at which Tair (Redis OSS-compatible) runs background tasks such as evicting expired keys and cleaning up idle connections. This can improve the efficiency of Tair (Redis OSS-compatible) in running such tasks.

Relationship between background tasks and the hz parameter

To periodically check the status of resources and services and perform operations based on specified policies, Tair (Redis OSS-compatible) invokes an internal function to run background tasks. The following list provides examples of background tasks:

  • Evict expired keys.

  • Close client connections that have timed out.

  • Update statistics.

The preceding background tasks ensure the normal operation of Tair (Redis OSS-compatible). The frequency at which these tasks are run is determined by the hz parameter. By default, the hz parameter is set to 10, which indicates that the tasks are run 10 times per second.

Valid values and suggested settings for the hz parameter

The valid values of the hz parameter are 1 to 500. If you increase the value of hz, Tair (Redis OSS-compatible) runs background tasks more frequently. This can increase CPU utilization. In most cases, you can use the default value 10. If you want to run specific background tasks more frequently, specify a value between 10 and 100. We recommend that you do not set the hz parameter to a value greater than 100 to prevent a sharp increase in CPU utilization.

Procedure

  1. Log on to the 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 the instance ID.

  2. In the left-side navigation pane, click Parameter Settings.

  3. On the page that appears, find the hz parameter and click Modify in the Actions column.

  4. In the dialog box that appears, perform the following steps:

    1. Change the value of the hz parameter based on your business requirements.

    2. Click OK.

Related API operations

API operation

Description

DescribeParameters

Queries the configuration and operational parameters of an instance.

ModifyInstanceConfig

Modifies the parameter settings of an instance.