Get the hottest keys from the last completed window, ordered by estimated QPS descending
HOTKEYS
GET
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:
key: the key name.db: the database in which the key was accessed.qps: the estimated accesses per second over the
completed window.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 can be slightly longer than
hotkeys-window-seconds. 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.
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.
O(N) where N is the number of hot keys in the history
@admin @dangerous @slow
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
ACL, ACL CAT, ACL DELROLE, ACL DELUSER, ACL DIGEST, ACL DRYRUN, ACL GENPASS, ACL GETROLE, ACL GETUSER, ACL HELP, ACL LIST, ACL LOAD, ACL LOG, ACL ROLES, ACL SAVE, ACL SETROLE, ACL SETUSER, ACL USERS, ACL WHOAMI, BGREWRITEAOF, BGSAVE, COMMAND, COMMAND COUNT, COMMAND DOCS, COMMAND GETKEYS, COMMAND GETKEYSANDFLAGS, COMMAND HELP, COMMAND INFO, COMMAND LIST, COMMANDLOG, COMMANDLOG GET, COMMANDLOG HELP, COMMANDLOG LEN, COMMANDLOG RESET, CONFIG, CONFIG GET, CONFIG HELP, CONFIG RESETSTAT, CONFIG REWRITE, CONFIG SET, DBSIZE, DEBUG, FAILOVER, FLUSHALL, FLUSHDB, HOTKEYS, HOTKEYS HELP, HOTKEYS RESET, INFO, LASTSAVE, LATENCY, LATENCY DOCTOR, LATENCY GRAPH, LATENCY HELP, LATENCY HISTOGRAM, LATENCY HISTORY, LATENCY LATEST, LATENCY RESET, LOLWUT, MEMORY, MEMORY DOCTOR, MEMORY HELP, MEMORY MALLOC-STATS, MEMORY PURGE, MEMORY STATS, MEMORY USAGE, MODULE, MODULE HELP, MODULE LIST, MODULE LOAD, MODULE LOADEX, MODULE UNLOAD, MONITOR, PSYNC, REPLCONF, REPLICAOF, RESTORE-ASKING, ROLE, SAVE, SHUTDOWN, SLOWLOG, SLOWLOG GET, SLOWLOG HELP, SLOWLOG LEN, SLOWLOG RESET, SWAPDB, SYNC, TIME.