Updated on 2023-08-29 GMT+08:00

Analyzing Big Keys and Hot Keys

By performing big key analysis and hot key analysis, you will have a picture of keys that occupy a large space and keys that are the most frequently accessed.

Notes on big key analysis:

  • All DCS Redis instances support big key analysis.
  • During big key analysis, all keys will be traversed. The larger the number of keys, the longer the analysis takes.
  • Perform big key analysis during off-peak hours and avoid automatic backup periods.
  • For a master/standby or cluster instance, the big key analysis is performed on the standby node, so the impact on the instance is minor. For a single-node instance, the big key analysis is performed on the only node of the instance and will reduce the instance access performance by up to 10%. Therefore, perform big key analysis on single-node instances during off-peak hours.
  • A maximum of 100 big key analysis records (20 for Strings and 80 for Lists/Sets/Zsets/Hashes) are retained for each instance. When this limit is reached, the oldest records will be deleted to make room for new records. You can also manually delete records you no longer need.

Notes on hot key analysis:

  • Only DCS Redis 4.0/5.0/6.0 instances support hot key analysis,
  • The maxmemory-policy parameter of the instance must be set to allkeys-lfu or volatile-lfu.
  • During hot key analysis, all keys will be traversed. The larger the number of keys, the longer the analysis takes.
  • Perform hot key analysis shortly after peak hours to ensure the accuracy of the analysis results.
  • The hot key analysis is performed on the master node of each instance and will reduce the instance access performance by up to 10%.
  • A maximum of 100 analysis records are retained for each instance. When this limit is reached, the oldest records will be deleted to make room for new records. You can also manually delete records you no longer need.

Perform big key and hot key analysis during off-peak hours to avoid 100% CPU usage.

Procedure for Big Key Analysis

  1. Log in to the DCS console.
  2. Click in the upper left corner of the management console and select the region where your instance is located.
  3. In the navigation pane, choose Cache Manager.
  4. Click the name of a DCS Redis instance.
  5. Choose Analysis and Diagnosis > Cache Analysis.
  6. On the Big Key Analysis tab page, you can manually start a big key analysis or schedule a daily automatic analysis.
  7. After an analysis task completes, click View to view the analysis results of different data types.

    You can also click Download or Delete in the Operation column to download or delete the analysis result.

    The console displays a maximum of 20 big key analysis records for Strings and 80 for Lists, Sets, Zsets, and Hashes.

    Table 1 Results of big key analysis

    Parameter

    Description

    Key

    Name of a big key.

    Type

    Type of a big key, which can be string, list, set, zset, or hash.

    Size

    Size or number of elements of a big key.

    Database

    Database where a big key is located.

Procedure for Hot Key Analysis

  1. Log in to the DCS console.
  2. Click in the upper left corner of the management console and select the region where your instance is located.
  3. In the navigation pane, choose Cache Manager.
  4. Click the name of a DCS Redis instance.
  5. Choose Analysis and Diagnosis > Cache Analysis.
  6. On the Hot Key Analysis tab page, you can manually start a hot key analysis or schedule a daily automatic analysis.

    If the instance was created before July 2020, the default value of the maxmemory-policy parameter is noeviction. If the instance was created in or after July 2020, the default value of the maxmemory-policy parameter is volatile-lru. To perform hot key analysis, set this parameter to allkeys-lfu or volatile-lfu on the Instance Configuration > Parameters page. For details about allkeys-lfu and volatile-lfu, see What Is the Default Data Eviction Policy?

  7. After an analysis task completes, click View to view the analysis results.

    You can also click Download or Delete in the Operation column to download or delete the analysis result.

    The console displays a maximum of 100 hot key analysis records for each instance.

    Table 2 Results of hot key analysis

    Parameter

    Description

    Key

    Name of a hot key.

    Type

    Type of a hot key, which can be string, hash, list, set, or sorted set.

    Size

    Size of the hot key value.

    FREQ

    Reflects the access frequency of a key within a specific period of time (usually 1 minute).

    FREQ is the logarithmic access frequency counter. The maximum value of FREQ is 255, which indicates 1 million access requests. After FREQ reaches 255, it will no longer increment even if access requests continue to increase. FREQ will decrement by 1 for every minute during which the key is not accessed.

    Shard

    Shard where the hot key is located.

    NOTE:

    This parameter is available only for cluster instances.

    Database

    Database where a hot key is located.