All Products
Search
Document Center

Tair (Redis® OSS-Compatible):Enable dynamic frequency control for background tasks

Last Updated:Nov 14, 2024

After the dynamic-hz feature is enabled for a Tair (Redis OSS-compatible) instance, the instance automatically adjusts the value of hz (frequency of background tasks) based on the current number of connections. This feature helps prevent instances becoming unresponsive or experiencing latency due to an excessive number of connections being scanned during background tasks.

Background information

The hz parameter specifies the frequency at which background tasks are run. The tasks include closing client connections that have timed out and evicting expired keys. For more information, see Adjust the frequency of background tasks.

During the processing of client connections, each background task scans a specific number of connections, which is determined by the value of clients/hz. The number of connections that are scanned in a task increases with the number of connections to the instance. If an excessive number of connections are scanned in a task, the instance may slow down and become unstable.

To address this issue, the Redis community introduced the dynamic-hz feature in Redis 5.0. This feature allows an instance to automatically adjust the value of hz based on the current number of connections to the instance. This prevents the instance from becoming overwhelmed when an excessive number of connections (clients/hz) are scanned in a single task.

The valid values of the dynamic-hz parameter are yes and no. The default value is yes. After you enable the dynamic-hz feature, the value that you specify for the hz parameter is assigned to the configured_hz parameter as the baseline frequency. Tair (Redis OSS-compatible) adjusts the value of hz based on the number of client connections to the Tair (Redis OSS-compatible) instance. The value of hz increases with the number of client connections. In this case, Tair (Redis OSS-compatible) runs background tasks more frequently.

You can run the INFO command to obtain the baseline value and the actual hz value after dynamic adjustment.

Prerequisites

The instance is compatible with Redis 5.0 or later.

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 dynamic-hz parameter and click Modify in the Actions column.

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

    1. Configure the dynamic-hz parameter.

    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.