ApsaraDB for Redis integrates the key analysis feature of Database Autonomy Service (DAS). This feature allows you to view big keys and hotkeys in instances in real time. It also allows you to query the historical big keys and hotkeys in the past four days. You can use this feature to obtain the key information, such as memory usage and access frequency of keys, and optimize operations based on the information.

Prerequisites

  • The instance is an instance of ApsaraDB for Redis Community Edition whose major version is 5.0 or a performance-enhanced instance of ApsaraDB for Redis Enhanced Edition (Tair).
  • The minor version of the instance is the latest. For more information about how to update the minor version of the instance, see Upgrade the minor version.

Definitions

Key Definition
Big key ApsaraDB for Redis sorts keys of the List, Hash, Set, and Zset types based on the number of elements. ApsaraDB for Redis considers the top three keys that have the most elements as big keys. If two keys have the same number of elements, the key that first reaches this number of elements ranks higher.
Note
Hotkey ApsaraDB for Redis uses efficient sorting and statistical algorithms based on the Least Frequently Used (LFU) algorithm to identify hotkeys of an instance.
Note
  • ApsaraDB for Redis Community Edition allows you to query up to 20 hotkeys at a time. ApsaraDB for Redis Enhanced Edition (Tair) allows you to query up to 50 hotkeys at a time.
  • If the number of queries per second (QPS) of a key is greater than 3,000, the key is considered to be a hotkey in most cases.

Procedure

  1. Log on to the ApsaraDB for Redis console.
  2. In the top navigation bar of the page, select the region where the instance is deployed.
  3. On the Instances page, click the ID of the instance.
  4. In the left-side navigation pane, choose CloudDBA > Key Analysis.
  5. Click the Real-time tab to view real-time data or click the History tab to view historical data based on your business requirements.
    Figure 1. Key Analysis page
    Key Analysis page
    Note
    • If the instance is a cluster instance or a read/write splitting instance, you can select a node from the Current Node drop-down list.
    • If the QPS of a key reaches 6,000, the system stops calculating the accurate QPS of the key. In this case, >=6000 is displayed for such a hotkey in the Access Frequency column.
    • On the History tab, you can query the historical big keys and hotkeys in the past four days. The time range to query cannot exceed three hours. For example, if the current time is 16:00 on July 15, 2021, you can query the big keys and hotkeys from 16:00 on July 11 to 16:00 on July 15. If you set the beginning of the time range to query to 16:00 on July 11, the ending of the time range to query cannot be later than 19:00 on July 11.

Related operations

Operation of the DAS API Description
DescribeHotBigKeys Queries the hotkeys and big keys in the memory in real time.
DescribeTopHotKeys Queries the top 20 hotkeys over a period of time.
DescribeTopBigKeys Queries the top 20 big keys over a period of time.
DescribeHotKeys Queries the hotkeys of an ApsaraDB for Redis instance.