Database Autonomy Service (DAS) provides the key analysis feature. This feature allows you to view the information of hot keys and large keys in your database instance, such as the memory that is used by keys, the distribution of keys in the memory, and the expiration time of each key. This way, you can optimize database performance based on the obtained data. This feature also helps you prevent issues caused by unbalanced distribution of keys in the memory, such as insufficient memory and reduced performance.

Prerequisites

Your database instance is an ApsaraDB for Redis instance that meets the following requirements:
  • The instance is an instance of ApsaraDB for Redis Community Edition whose major version is 5.0 or later or a performance-enhanced instance of ApsaraDB for Redis Enhanced Edition (Tair). For information about performance-enhanced instances, see DRAM-based instances.
  • The instance is updated to the latest minor version. For more information, see Update the minor version.

Definitions

KeyDefinition
large keyApsaraDB for Redis sorts list, hash, set, and zset keys based on the number of elements in these keys. ApsaraDB for Redis considers the top three keys that have the most elements as large keys. If two keys have the same number of elements, the key that first reaches this number ranks higher.
Note
  • For a cluster instance or a read/write splitting instance, the system displays the top three largest keys in each data shard or read replica.
  • You can use the offline key analysis feature to obtain more statistics about large keys, such as the memory usage and distribution of keys, the memory usage and distribution of elements in keys, and the expiration time of keys. For more information, see Offline key analysis.
  • Statistics about keys that are not queried for a long time period may not be collected. For more information about how to obtain details about large keys, see Offline key analysis.
hotkeyApsaraDB for Redis uses efficient sorting and statistical algorithms based on the Least Recently Used (LRU) key eviction policy to identify hotkeys in 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.
  • In most cases, if the number of queries sent for a key per second is greater than 3,000, the key is considered to be a hotkey.

Procedure

  1. Log on to the DAS console.
  2. In the left-side navigation pane, click Instance Monitoring.
  3. Find the database instance that you want to manage and click the instance ID. The instance details page appears.
  4. In the left-side navigation pane, click Key Analysis.
  5. Click the Real-time or History tab to view the information displayed in the Hot Key and Big Key sections.
    Note On the History tab, you can query the information of large keys and hot keys that are analyzed within the last four days. The maximum interval between the start time and the end time is 3 hours.

References

Related API operations