Database Autonomy Service (DAS) provides the key analysis feature. You can use this feature to view the information about hot keys and big keys in your database instance. For example, you can view the memory that is used by keys, how the keys are distributed in the memory, and the time at which each key expires. This way, you can optimize database performance based on the queried data. The key analysis feature also helps you prevent issues caused by unbalanced distribution of keys in the memory, such as out of memory and reduced performance.

Prerequisites

An ApsaraDB for Redis instance that meets the following requirements is created:
  • 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). For more information about the performance enhanced instance, see Performance-enhanced instances.
  • The minor version of the instance is the latest version. For more information about how to update the minor version of the instance, see Update 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 DAS console.
  2. In the left-side navigation pane, click Key Analysis.
  3. Click the Real-time or History tab to view the information about hot keys and big keys.
    Note On the History tab, you can view the information about big keys and hot keys. On the History tab, you can query the information about big keys and hot keys that are analyzed within the last four days. The maximum interval between the start time and the end time is three hours.

References

Related API operations