Advertisement
Intermediate Redis, Redis Monitoring & Observability

What is the Redis slow log, and how do you use it to identify commands that are taking longer than expected to execute?

Short answer

The slow log automatically records any command that takes longer than a configured threshold to execute, and you review it using the SLOWLOG GET command, which shows you the specific slow commands along with their execution time, helping you identify problematic queries or…

Save Redis mock interview
Advertisement
AModel answer
The slow log automatically records any command that takes longer than a configured threshold to execute, and you review it using the SLOWLOG GET command, which shows you the specific slow commands along with their execution time, helping you identify problematic queries or patterns that might be affecting your overall Redis performance.
Example

CONFIG SET slowlog-log-slower-than 10000 SLOWLOG GET 10

Real-world example
A team investigating occasional latency spikes reviews their slow log, discovering a specific command pattern from a reporting script was consistently appearing, leading them to optimize that particular operation.
Likely follow-ups
  • What unit is the slowlog-log-slower-than threshold measured in?
  • How much history does the slow log retain by default?
Related topics