TIL: redis-cli MONITOR is still a footgun, not a tool
Wanted to see what was going on with a Redis that seemed overloaded. Reflexively typed redis-cli MONITOR. Output streamed by, server load jumped, and a coworker said “uh.”
Turns out MONITOR streams every command the server processes to the connected client. On a Redis doing 20k ops/sec, that’s 20k prints per second. The client can’t keep up, so Redis has to buffer, which costs memory, and the server work per-command roughly doubles.
Docs actually warn about this. I’d forgotten.
What I should’ve done: redis-cli --stat for high-level ops/sec and memory, or SLOWLOG GET 10 for the slowest recent commands, or CLIENT LIST to see who’s connected. All of those are cheap.
If you genuinely need per-command insight, use the latency command family:
redis-cli LATENCY HISTORY event
redis-cli LATENCY LATEST
Those tell you about unusually slow operations without streaming every command.
MONITOR is fine in a dev environment. In prod, it’s closer to strace -f on a busy server — exists for a reason but not your first reach.