When memory or CPU usage increases in your Tair or Redis instance, you can use the Top Key Statistics feature to quickly identify large keys and hot keys. This feature displays real-time and historical data about these keys—such as keys with many elements, keys that use a large amount of memory, and frequently accessed hot keys—to help you resolve performance issues.
Identification and ranking mechanism
To avoid placing extra load on your database, this feature collects statistics only on keys accessed by client read or write operations. It retains and displays only a specified number of top keys for each type, rather than scanning all keys in the database in real time. Additionally, after an instance restarts or a high availability (HA) switchover occurs, the collected statistics are cleared, and the process begins again. As a result, keys that have not been accessed for a long time may not be included in the statistics. To analyze the memory usage and distribution of all keys in your database, use the Offline Key Analysis feature.
Key type | Applicable versions | Statistical mechanism | Description |
Large key (by number of elements) |
| A key is considered a large key if its number of elements, such as fields in a Hash or members in a Set, reaches or exceeds a threshold (default: 2,000). You can customize this threshold by setting the Note
| Displays up to the top three large keys for each data type. If multiple keys have the same number of elements, the one that was written first is prioritized. Note
|
Large key (by memory usage) | Cloud-native memory-optimized instances of Tair (Enterprise Edition) with minor version 25.6.0.0 or later. |
| Displays up to the top three large keys for each data type. If keys have the same memory usage, the one that was written first is prioritized. |
Hot key (by QPS) |
| A key is considered a hot key if its queries per second (QPS) exceeds 5,000. You can customize this threshold by setting the | The system displays up to the top 50 hot keys and shows their precise real-time QPS. |
Hot key (by traffic) | Cloud-native memory-optimized instances of Tair (Enterprise Edition) with minor version 25.2.0.0 or later. | A key is considered a hot key if its access traffic exceeds 1 MB/s.
| The system displays up to the top 50 hot keys and shows their precise inbound and outbound traffic, as well as access frequency. Note Statistics for non-existent keys are supported. If the data type is displayed as not-exist-key, it indicates that the key does not exist but is frequently accessed. |
Procedure
Log on to the console and go to the Instances page. In the top navigation bar, select the region in which the instance that you want to manage resides. Then, find the instance and click the instance ID.
In the left-side navigation pane, choose .
On this page, you can view real-time and historical data.
The Top Key Statistics page contains four sections: Real-time Large Keys, Historical Large Keys, Real-time Hot Keys, and Historical Hot Keys. You can set the thresholds for identifying large and hot keys, click Refresh to manually fetch the latest data, or enable Auto-refresh to automatically update the results.
NoteIf your instance uses a cluster architecture or a read/write splitting architecture, you can also select a specific node from the Current Node drop-down list to view its data.
You can query historical data from the last four days. The maximum time range for a single query is three hours.
API reference
DAS API | Description |
Gets real-time hot keys and large keys that are currently in memory. | |
Gets the top 20 hot keys over a specified period. | |
Gets the top 20 large keys over a specified period. | |
Gets the hot keys of a Redis instance. |
FAQ
Q: Why are String-type keys displayed under Large key (by number of elements)?
A: In Redis Open-Source Edition and some earlier versions of Tair, String-type keys are displayed if their value length exceeds the threshold, which defaults to 2,000.
Why does a key with fewer than 10 elements appear as a large key?
The most likely cause is that the key name itself is large. Run
memory usage key_nameto check its actual memory footprint. If the result is unexpectedly high, consider renaming or restructuring the key.A less common cause is an outdated minor version. Instances with a minor version earlier than 5.2.7 have a default
bigkey-thresholdof 0, which causes keys with small memory usage to appear as large keys. Upgrade the minor version to resolve this.