All Products
Search
Document Center

Tair:Query historical hotkeys

Last Updated:Sep 22, 2023

In a Tair instance, 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 the historical hotkeys. This allows you to further optimize your instance.

Prerequisites

The audit log feature is enabled. For more information, see Enable the audit log feature.

Background information

Tair uses efficient sorting and statistical algorithms based on the Least Frequently Used (LFU) cache 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.

This topic describes how to view historical hotkeys by using the audit log feature. For more information about how to display real-time hotkeys, see Use the real-time key statistics feature.

Procedure

  1. Log on to the Tair 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 Log.

  3. On the Audit Log page, click the Official Version tab. In the upper-right corner, click Time Range. In the Time panel, specify a time range that you want to query. In this example, 1 Week is selected, which indicates the last 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.

    qps

    "qps":"4500-5000"

    The queries for the hotkey per second. The value is displayed as a range.

    Note

    If the queries for a key per second reach 6,000, the key is determined to be a hotkey and the system stops calculating the accurate queries for the key per second. In this case, >=6000 is displayed for such a hotkey.

    key

    "key":"key:000000000008"

    The hotkey.