All Products
Search
Document Center

Database Autonomy Service:Key analysis

Last Updated:Mar 04, 2024

Database Autonomy Service (DAS) provides the key analysis feature. This feature allows you to view the large keys and hot keys in your database instance in real time. You can also view the large keys and hot keys that are detected in the last four days. This allows you to obtain data such as the key access frequency and the number of elements. 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 DRAM-based instance of ApsaraDB for Redis Enhanced Edition (Tair). For information about DRAM-based instances, see DRAM-based instances.

  • The minor version of the instance is the latest. For more information, see Update the minor version of an instance.

Definitions

Key type

Definition

Large keys

ApsaraDB 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 Use the offline key analysis feature.

  • Keys that are not queried for a long period of time may not be included or accounted for in a statistical analysis. For more information about how to obtain details about large keys, see Use the offline key analysis feature.

Hotkeys

ApsaraDB 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 to a key per second is more 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 detected in the last four days. The maximum interval between the start time and the end time is 3 hours.

References

For more information about how to use the key analysis feature in the ApsaraDB for Redis console, see Use the real-time key statistics feature.

Related operations

Operation

Description

DescribeHotBigKeys

Queries the hot keys and large keys in the memory in real time.

DescribeTopHotKeys

Queries the top 100 hot keys over a period of time.

DescribeTopBigKeys

Queries the top 100 large keys over a period of time.

DescribeHotKeys

Queries the hot keys of an ApsaraDB for Redis instance.