All Products
Search
Document Center

Tair (Redis® OSS-Compatible):Query historical hotkeys

Last Updated:Jun 14, 2024

In ApsaraDB for Redis, the keys that are frequently accessed are called hotkeys. Improper management of hotkeys may cause congestion and degrade service performance. You can use the audit log feature to query and analyze historical hotkeys. This allows you to further optimize your instance.

Prerequisites

The audit log feature is enabled for the ApsaraDB for Redis instance. For more information, see Enable the audit log feature.

Background information

ApsaraDB for Redis uses efficient sorting and statistical algorithms on top of the Least Frequently Used (LFU) algorithm to identify hotkeys in an instance.

Note

If the number of queries per second (QPS) for a key is greater than 3,000, the key is considered to be a hotkey.

Procedure

  1. Log on to the ApsaraDB for Redis 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 Logs > Audit Logs.

  3. On the Audit Logs page, click the Official Version tab. In the upper-right corner, click Time Range. In the panel that appears, specify a time range that you want to query. In this example, 1 Week is selected, which specifies the previous week.

  4. Clear the default filter conditions in the Keyword field, enter type:7, and then press the Enter key. The type:7 filter condition is used to query hotkeys.

  5. In the Audit log detail section, view the details of the historical hotkeys.

    历史热点Key详情

    Note

    The Client ip column displays 127.0.0.1, which is the IP address of the local host of the Tair instance.

    In the Command column, view the details of the hotkeys. The following table describes the fields in the hotkey details.

    Field

    Example value

    Description

    dbid

    "dbid":0

    The database in which the hotkey resides.

    type

    "type":"string"

    The type of data structure that the hotkey uses.

    lfu

    "lfu":241

    The LFU value of the hotkey.

    Note

    For Redis Community Edition 7.0.18, 6.0.2.9, or 5.5.2.9 instances or Tair DRAM-based instances of version 5.0.50 and later, this field is no longer used and is fixed to 0.

    qps

    "qps":"6000"

    • For Redis Community Edition 7.0.18, 6.0.2.9, or 5.5.2.9 instances or Tair DRAM-based instances of version 5.0.50 and later, this field indicates the exact QPS of the hotkey.

    • In earlier versions, the approximate QPS range can be displayed only if the QPS of a hotkey is less than 6,000. For example, "qps":"4500-5000" is a rough estimate of the QPS range, and 6000 is the maximum value in the approximate range.

    key

    "key":"key:000000000008"

    The hotkey.