HOTKEYS
Since 1.1.0Observability
Syntax
HOTKEYSHOTKEYS finds the keys that cost the server the most over a period: the CPU time spent on the commands that name them, the network bytes those commands read and wrote, or both. Use it when one key, or a few, may be taking more than their share, and you want their names rather than totals. It is Redis 8.6's command.
| Subcommand | |
|---|---|
HOTKEYS START | start a session: the metrics, how many keys to report, and for how long |
HOTKEYS STOP | stop the session, keeping its results |
HOTKEYS GET | the results of the running or the last session |
HOTKEYS RESET | discard a stopped session's results |
HOTKEYS HELP | the list, from the server |
There is one session at a time, for the whole server. While it runs, each command's run time and bytes are charged to the keys it names. When no session is running, the cost to a command is a single check. A session ends with HOTKEYS STOP, or by itself after the DURATION given to START; its results stay until HOTKEYS RESET or the next START. HOTKEYS alone is an error. See Monitoring.
Examples
> HOTKEYS START METRICS 2 CPU NET COUNT 3
OK
> SET k1 hello
OK
> GET k1
"hello"
> HOTKEYS STOP
OK
> HOTKEYS GET
1) 1) "tracking-active"
2) (integer) 0
...
> HOTKEYS RESET
OK
> HOTKEYS
(error) ERR wrong number of arguments for 'hotkeys' command
Subcommands
- HOTKEYS GET: Returns the current or latest session: whether it is still running, its settings, its totals, and the top keys by CPU time (by-cpu-time-us) and by network bytes (by-net-bytes).
- HOTKEYS HELP: Lists the HOTKEYS subcommands, with their arguments and a line on what each does: START and its options, STOP, GET, RESET and HELP itself.
- HOTKEYS RESET: Discards the results of a stopped HOTKEYS session, so that HOTKEYS GET returns nil again.
- HOTKEYS START: Starts a session that tracks, per key, the metrics named: CPU (CPU time) and NET (network bytes).
- HOTKEYS STOP: Stops the running HOTKEYS session.