How would you use redis-cli's built-in monitoring and debugging features to troubleshoot a live performance issue on a production Redis instance?
Short answer
You could use the MONITOR command to see a live stream of every command being processed by the server, though carefully since it adds overhead and should be used briefly, the SLOWLOG command to review commands that have taken longer than a configured threshold to execute, and…
Advertisement
AModel answer
You could use the MONITOR command to see a live stream of every command being processed by the server, though carefully since it adds overhead and should be used briefly, the SLOWLOG command to review commands that have taken longer than a configured threshold to execute, and the LATENCY tool to identify specific sources of delay within Redis's internal operations.
Example
redis-cli slowlog get 10 redis-cli latency history command
Real-world example
A team investigating intermittent slow responses uses SLOWLOG to identify a specific command pattern that was consistently taking much longer than expected, quickly pinpointing the root cause of their performance issue.
Likely follow-ups
- Why should MONITOR be used sparingly on a busy production server?
- How do you clear the slow log once you have finished reviewing it?
Related topics