Queries top 20 hot keys over a period of time.

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

  • If you use Alibaba Cloud SDK, make sure that the aliyun-sdk-core version is later than V4.3.3. We recommend that you use the latest version.
  • The version of Database Autonomy Service (DAS) SDK must be V1.0.2 or later.
  • If you use an SDK to call the DAS service, you must set the region to cn-shanghai.
  • The DescribeTopHotKeys operation is available only for ApsaraDB for Redis that meets one of the following requirements:
    • ApsaraDB for Redis Community Edition V4.0 or V5.0, minor version V0.4.0 or later
    • ApsaraDB for Redis Enhanced Edition (Tair) V5.0, minor version V1.5.1 or later
Note For information about how to query and update the minor version of an instance, see DescribeEngineVersion and ModifyInstanceMinorVersion.

Request parameters

Parameter Type Required Example Description
Action String Yes DescribeTopHotKeys

The operation that you want to perform. Set the value to DescribeTopHotKeys.

ConsoleContext String No None

The hidden parameter.

InstanceId String Yes r-bp18ff4a195d****

The ID of the ApsaraDB for Redis instance. You can call the DescribeInstances operation to query the ID.

NodeId String No r-****-db-0

The ID of the data shard on the ApsaraDB for Redis instance. You can call the DescribeRoleZoneInfo operation to query the ID.

StartTime String Yes 1596177993000

The beginning of the time range to query. Specify a UNIX timestamp in milliseconds.

EndTime String Yes 1596177993001

The end of the time range to query. Specify a UNIX timestamp in milliseconds.

Note
  • The end time must be later than the start time.
  • You can query the data that is generated in the last four days.
  • The maximum interval between the start time and the end time is 3 hours.

Response parameters

Parameter Type Example Description
Message String Successful

The returned message for the request.

RequestId String B6D17591-B48B-4D31-9CD6-9B9796B2****

The ID of the request.

Data Array of HotKey

The details of the hot keys.

HotKey
Db Integer 0

The database in which the key is stored.

Key String abc:def:eng

The name of the key.

Hot String 5500~6000

The QPS of the key.

KeyType String zset

The type of the key.

Lfu Integer 253

The statistical value that is calculated based on the least frequently used (LFU) caching algorithm.

NodeId String r-x****-db-0

The ID of the data shard on the ApsaraDB for Redis instance.

Code String 200

The returned status code.

Success String true

Indicates whether the request is successful. Valid values:

  • true: The request is successful.
  • false: The request fails.

Examples

Sample requests

http(s)://das.cn-shanghai.aliyuncs.com/?Action=DescribeTopHotKeys
&ConsoleContext=None
&InstanceId=r-bp18ff4a195d****
&NodeId=r-****-db-0
&StartTime=1596177993000
&EndTime=1596177993001
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<DescribeTopHotKeysResponse>
    <Message>Successful</Message>
    <RequestId>B6D17591-B48B-4D31-9CD6-9B9796B2****</RequestId>
    <Data>
        <Db>0</Db>
        <Key>abc:def:eng</Key>
        <Hot>5500~6000</Hot>
        <KeyType>zset</KeyType>
        <Lfu>253</Lfu>
        <NodeId>r-x****-db-0</NodeId>
    </Data>
    <Code>200</Code>
    <Success>true</Success>
</DescribeTopHotKeysResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "Message" : "Successful",
  "RequestId" : "B6D17591-B48B-4D31-9CD6-9B9796B2****",
  "Data" : [ {
    "Db" : 0,
    "Key" : "abc:def:eng",
    "Hot" : "5500~6000",
    "KeyType" : "zset",
    "Lfu" : 253,
    "NodeId" : "r-x****-db-0"
  } ],
  "Code" : "200",
  "Success" : "true"
}

Error codes

For a list of error codes, visit the API Error Center.