Redis Performance Monitoring

Monitoring Redis, an in-memory data structure store, is crucial to ensure its performance, availability, and efficient resource utilization.

By tracking metrics such as command latency, memory usage, CPU utilization, and throughput, you can identify areas for optimization and fine-tune your Redis configuration for optimal performance.

Redis monitoring

Redis metrics to monitor

You can use a monitoring solution or agent to collect key performance metrics from Redis, such as CPU usage, memory consumption, throughput, latency, and cache hit rates. These metrics provide insights into the overall health and performance of your Redis instances.

Latency. .Measure the response time of Redis commands to assess the performance of your Redis instances. Track latency metrics for commonly used commands to identify potential bottlenecks and ensure acceptable response times.

Memory usage. Keep an eye on Redis memory usage to ensure it stays within acceptable limits. Monitor metrics like used memory, memory fragmentation, and eviction rates to identify potential memory leaks or inefficient memory utilization.

CPU utilization. Monitor CPU usage to ensure that your Redis instances are not under excessive load. High CPU usage can impact the responsiveness and performance of Redis. Track CPU metrics and identify any spikes or sustained high usage that may require optimization or scaling.

Throughput. Monitor the throughput of Redis by measuring the number of commands processed per second. Track metrics such as total commands, operations per second, or requests per second to understand the workload on your Redis instances and identify any sudden changes or spikes in traffic.

Keyspace. Monitor the size and distribution of keys within Redis to identify memory-consuming or frequently accessed keys. Analyze metrics like the number of keys, key sizes, and key eviction rates to optimize memory usage and performance.

Network. Monitor network traffic and bandwidth usage of Redis to identify any potential bottlenecks or network-related issues. Track metrics such as incoming and outgoing network traffic to ensure optimal network performance.

Logs. Monitor Redis logs for warnings, errors, or other important messages. Centralized log management solutions can help you analyze log data, detect patterns, and troubleshoot issues.

By monitoring these aspects of Redis, you can ensure optimal performance, troubleshoot issues promptly, and maintain the stability and reliability of your Redis infrastructure.

Redis INFO

When you run the INFO command in Redis, it returns a comprehensive set of metrics and information about the Redis server, allowing you to monitor its performance, resource usage, and operational aspects.

OpenTelemetry Redisopen in new window receiver periodically runs the INFO command to collect telemetry data from Redis and send it to your observability pipeline for analysis and monitoring. It integrates with OpenTelemetry, which is a set of standard APIs, libraries, and instrumentation for collecting and exporting telemetry data.> info keyspace
# Keyspace

Memory fragmentation

Memory fragmentation occurs when memory is allocated and deallocated, leading to unused gaps between allocated blocks of memory. This fragmentation can lead to inefficient memory usage and increased memory footprint.

Redis manages memory using its own memory allocator. When objects are created, Redis allocates memory blocks to store them. Over time, objects can be deallocated, resulting in gaps or holes in the allocated memory.

Fragmentation can lead to higher overall memory usage in Redis, as fragmented memory blocks cannot be effectively reused. Allocating memory for new objects can become slower and more resource-intensive due to the need to search for contiguous memory blocks.

It is important to monitor memory fragmentation levels in Redis using tools like INFO memory command or third-party monitoring solutions. If fragmentation becomes a concern, you can take proactive measures such as periodically restarting Redis, adjusting memory policies, or utilizing external memory allocators.> info memory
# Memory

Active defragmentation

Defragmentation in Redis works by scanning the keyspace and moving Redis objects (such as strings, lists, sets, etc.) to new memory locations, thereby eliminating the fragmentation. It operates in the background, ensuring that the process does not impact the normal Redis operations.

Active defragmentation is an optional feature and needs to be enabled in the Redis configuration. You can enable it by setting the activedefrag option to yes in the Redis configuration file or by using the CONFIG SET command.

CONFIG SET activedefrag yes

Redis Latency Monitor

Redis latency monitoringopen in new window is crucial for assessing the performance of your Redis instance and identifying potential bottlenecks or issues.

You can track Redis command latency using the LATENCY command in Redis. The LATENCY DOCTOR command provides a summary of the latency distribution, while the LATENCY HISTORY command offers historical information about latency measurements.

You can enable the latency monitor at runtime with the following command:

CONFIG SET latency-monitor-threshold 100

Keep in mind that enabling Active Defrag may introduce some additional CPU and I/O overhead due to the memory relocation process. Therefore, it's essential to monitor the overall system performance when using this feature.

Redis SlowLog

Redis slowlogopen in new window is a feature that allows you to track and analyze Redis commands that exceed a certain execution time threshold. When enabled, Redis will log these slow commands in a dedicated slowlog, providing valuable insights into the performance of your Redis instance.

To enable the slowlog feature, you can set the configuration parameter slowlog-log-slower-than in your Redis configuration file or use the CONFIG SET command to dynamically configure it. This parameter specifies the threshold execution time in microseconds, and any command exceeding this threshold will be logged in the slowlog.

You can retrieve slowlog entries using the SLOWLOG GET command. This command allows you to fetch a specified number of slowlog entries or retrieve all the entries. Each slowlog entry is represented as an array of values containing the relevant information about the slow command.

By default, Redis stores the last 128 entries, but you can configure the maximum number of entries using the slowlog-max-len configuration parameter.

Redis slowlog provides a valuable tool for identifying and analyzing slow commands, helping you optimize the performance of your Redis instance and troubleshoot potential performance issues. It is particularly useful for understanding and addressing bottlenecks in your Redis workload.


Redis monitoring plays a vital role in maintaining the stability, performance, and security of your Redis infrastructure. It enables you to optimize resource utilization, troubleshoot issues efficiently, and make data-driven decisions to ensure the reliable and efficient operation of your Redis deployment.

Last Updated:
Uptrace is an open-source APM and DataDog alternative that supports OpenTelemetry traces, metrics, and logs. You can use it to monitor apps and set up alerts to receive notifications via email, Slack, Telegram, and more. View on GitHub →Uptrace Demo