- Usage:
-
HOTKEYS GET
- Complexity:
- O(N) where N is the number of hot keys in the history
- Since:
- 9.2.0
- ACL Categories:
- @admin, @dangerous, @slow
key: the key name.db: the database in which the key was accessed.qps: the estimated accesses per second over the completed window.
The HOTKEYS GET command returns the hottest keys observed during the last
completed tracking window, ordered by estimated queries per second (QPS), from
highest to lowest. It takes no arguments and returns at most hotkeys-top-k
entries.
See HOTKEYS and Hot key tracking for how
tracking is enabled and configured, what an empty reply can mean, and how state
is reset.
Each entry contains:
qps is an estimate rather than an exact value, because accesses are sampled
when hotkeys-sampling-percentage is below 100 (its default is 1), and
because only hotkeys-top-k keys are tracked at a time. It is a rate over the
span the window actually covered, which INFO reports as
hotkeys_last_window_duration_ms in its hotkeys section. See
Choosing the sampling percentage and window
for how accuracy depends on those two settings.
A key that is accessed but does not exist is tracked like any other. This surfaces load against a missing key, for example from a bad key template or a stampede against a key an eviction just removed.
The command returns an empty array when there is nothing to report: either hot key tracking is disabled, or no hot keys were tracked in the last completed window.
Reply
Array of the hottest keys of the last completed window, ordered by estimated QPS descending. Each element is a map with the fields key, db and qps.
Examples
Enable tracking, then read the hottest keys:
127.0.0.1:6379> CONFIG SET hotkeys-top-k 16
OK
127.0.0.1:6379> HOTKEYS GET
1) 1) "key"
2) "product:8fd21a"
3) "db"
4) (integer) 0
5) "qps"
6) (integer) 48200
2) 1) "key"
2) "session:2c1f09"
3) "db"
4) (integer) 0
5) "qps"
6) (integer) 12700