In an ApsaraDB for Redis 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 history of hotkeys. This allows you to further optimize your instance.

Background information

ApsaraDB for Redis uses efficient sorting and statistical algorithms based on the Least Frequently Used (LFU) algorithm to identify hotkeys of an instance.
Note If the number of queries per second (QPS) of a key is greater than 3,000, the key is regarded as a hotkey.

Procedure

  1. Log on to the ApsaraDB for Redis console.
  2. In the top navigation bar of the page, select the region where the instance is deployed.
  3. On the Instances page, click the ID of the instance.
  4. In the left-side navigation pane, choose Logs > Audit Log.
  5. On the Audit Log page, click Please Select in the upper-right corner. In the dialog box that appears, specify a time range that you want to query. In this example, 1 Week is selected.
    Select a time range
  6. Clear the default filter conditions in the Keyword field. Enter type:7 and press Enter to query hotkeys.
    Set the Keyword field
  7. The Audit log detail section displays the hotkeys that are returned.
    History of hotkeys
    Note The Client ip column displays 127.0.0.1 to indicate the IP address of the on-premises host of the ApsaraDB for Redis instance.

    The Command column displays the details of the hotkeys that are found. The following table describes the fields in each command.

    Field Example Description
    dbid "dbid":0 The database in which the hotkey is located.
    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 QPS of the hotkey. The value is displayed as a range.
    key "key":"key:000000000008" The hotkey that is returned.