Question: How can one assess and optimize Redis performance statistics?


Redis provides several commands to monitor and optimize its performance. These commands can help you understand how your Redis instance is behaving and where potential bottlenecks might be.

INFO Command

The INFO command in Redis can provide a wealth of information about the current state of your Redis server. This includes things like memory usage, CPU usage, number of connected clients, and more.

Here's an example of using the INFO command:> INFO

This will return a lot of data. To get specific information about performance, look for sections starting with # Stats, # Memory, # CPU etc.


The MONITOR command is a debugging command that streams back every command processed by the Redis server. It can be useful for understanding what's happening on your Redis server at any given moment but be cautious as it may decrease overall performance due to the high amount of data it outputs.

Example:> MONITOR


The SLOWLOG command gets and sets the Redis slow queries log. This can be very helpful to understand which commands are taking the most time to execute and how often they are called.

For example, to get the five slowest queries:> SLOWLOG GET 5

To configure Redis to keep track of the 100 slowest queries, you can use the CONFIG SET command:> CONFIG SET slowlog-log-slower-than 10000> CONFIG SET slowlog-max-len 100

In the above, slowlog-log-slower-than is set to 10000 microseconds (10 milliseconds), and slowlog-max-len is set to keep track of the top 100 slow queries.

Remember to use these tools wisely and make sure you don't affect your Redis performance negatively while trying to monitor it. As always, testing in a non-production environment first is recommended.

Was this content helpful?

White Paper

Free System Design on AWS E-Book

Download this early release of O'Reilly's latest cloud infrastructure e-book: System Design on AWS.

Free System Design on AWS E-Book

Start building today

Dragonfly is fully compatible with the Redis ecosystem and requires no code changes to implement.