All Products
Search
Document Center

Tair (Redis® OSS-Compatible):Use the top key statistics feature

Last Updated:Apr 01, 2025

When the memory usage or CPU utilization of Tair and Redis increases, you can use the Top Key Statistics feature to quickly identify large keys and hotkeys. This feature displays real-time and historical information about large keys and hotkeys in your instance, including keys with a large number of elements, keys that consume a significant amount of memory, and frequently accessed hotkeys. This helps you effectively resolve instance performance issues.

Prerequisites

The instance runs Redis Open-Source Edition 5.0 or later, or the instance is a Tair (Enterprise Edition) DRAM-based or persistent memory-optimized instance.

Statistical ranking mechanisms for large keys and hotkeys

Key type

Statistical ranking mechanism

Large keys (keys with a large number of elements)

Keys are ranked based on the string length (only for the String type) or number of elements. When the string length or number of elements in a key reaches 2,000 or more, the key is counted as a large key.

Note

The system displays up to three top-ranked keys for each data type. When multiple keys have the same number of elements, the key that is written first is displayed first. If only three large keys are displayed for your instance, update the minor version and try again.

Large keys (keys that consume a significant amount of memory)

Keys are ranked based on memory usage. The MEMORY USAGE command is used to determine the memory usage of each key. When a single element is larger than 50 KB or the entire object is larger than 500 MB, the key is counted as a large key.

Note
  • This feature is available only for instances running Tair (Enterprise Edition) 6.0 or later.

  • The system displays up to three top-ranked keys. When multiple keys have the same memory usage, they are sorted in lexicographic order.

Hotkeys

When the number of queries per second (QPS) of a key exceeds 5,000, the key is recorded as a hotkey, and its exact QPS is displayed in real time. The system can track up to 50 hotkeys at the same time.

Note

We recommend that you upgrade your Redis Open-Source Edition instance to 7.0.18, 6.0.2.9, or 5.5.2.9, or upgrade your Tair DRAM-based instance to 5.0.50, 24.5.1.0, or later. In earlier versions, a key is recorded as a hotkey when its QPS exceeds 3,000, and only an approximate QPS range is displayed. Additionally, up to 20 hotkeys can be tracked at the same time for each Redis Open-Source Edition instance.

This feature supports the following data structures:

  • Native Redis data structures: String, List, Hash, Set, Zset, and Stream

  • Tair proprietary data structures: TairString, TairHash, TairGIS, TairBloom, TairDoc, TairCpc, TairZset, TairRoaring, TairTS, and TairSearch

Procedure

  1. 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.

  2. In the left-side navigation pane, choose CloudDBA > Top Key Statistics.

  3. 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 analysisKey分析

    Note
    • If your instance uses the cluster architecture or read/write splitting architecture, you can also select a node from the Current Node drop-down list to display data for that node.

    • On the History tab, you can query the historical large keys and hotkeys within the previous four days. The time range to query cannot exceed 3 hours.

Related API operations

DAS API operations

Description

DescribeHotBigKeys

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

DescribeTopHotKeys

Queries the top 20 hotkeys over a specific period of time.

DescribeTopBigKeys

Queries the top 20 large keys over a specific period of time.

DescribeHotKeys

Queries the hotkeys of an instance.