Use this reference to identify the root cause of a Redis latency event and apply the appropriate fix.
Before you start
Check these common causes before diving into specific events:
Slow commands. Commands that scan all keys (for example,
KEYS) block the main thread. Review slow query logs to find them. See Query slow query logs.Large keys. Large keys slow down eviction and expiration. Use offline key analysis to identify them. See Use the offline key analysis feature.
High memory usage. When occupied memory exceeds the
maxmemorylimit, eviction cycles run frequently. See Change the configurations of an instance.
Background
Redis 2.8.13 introduced latency monitoring, which collects data from the last 160 seconds and records only the highest-latency event per second.
Tair (Redis OSS-compatible) provides latency insights, an advanced alternative that records up to 27 events with the execution durations of all commands, and retains latency statistics for the last three days. For event names and their latency thresholds, see Common special events.
Common latency events
Some events have a parent-child relationship:
AofWriteis the parent event. Each time data is written to an append-only file (AOF), Redis recordsAofWritealong with exactly one of three child events:AofWriteAlone,AofWriteActiveChild, orAofWritePendingFsync. To find the specific cause, analyze the child event.EvictionCycleis the parent event for eviction. AnalyzeEvictionDelandEvictionLazyFreetogether to determine what is driving the eviction latency.
| Event | What it measures | Common cause | What to do |
|---|---|---|---|
EvictionCycle | Time for a full eviction cycle, including key selection, deletion, and background thread wait | Multiple factors — analyze EvictionDel and EvictionLazyFree to pinpoint the cause | Review key usage and optimize business data. If evictions occur frequently, scale up the instance to keep memory usage below maxmemory. |
EvictionDel | Time to delete keys during an eviction cycle | Large keys being evicted | Avoid large keys. Enable asynchronous eviction by setting lazyfree-lazy-eviction to yes. If evictions occur frequently, scale up the instance. |
EvictionLazyFree | Time waiting for background threads to release memory | No evictable keys are available while background threads are freeing memory (for example, by deleting large keys) | Adjust the memory eviction policy using the maxmemory-policy parameter. If evictions occur frequently, scale up the instance. |
ExpireCycle | Time for a key expiration cycle | Large keys being deleted | Avoid large keys. Enable asynchronous expiration by setting lazyfree-lazy-expire to yes. Clear expired data regularly in the console. |
ExpireDel | Time to delete keys during a key expiration cycle | Large keys being deleted | Avoid large keys. |
AofWrite | Total time to write data to AOFs | Multiple factors — analyze AofWriteAlone, AofWriteActiveChild, and AofWritePendingFsync to pinpoint the cause | If data persistence is not required, disable AOF by setting appendonly to no. |
AofWriteAlone | Time for an AOF write with no concurrent child processes or pending fsync | Large write volume or disk performance bottlenecks | If AOF is not required, set appendonly to no. |
AofWriteActiveChild | Time for an AOF write while child processes are also writing to disk | Child process disk I/O competing with AOF writes | If AOF is not required, set appendonly to no. |
AofWritePendingFsync | Time for an AOF write while a background fsync is in progress | Background fsync competing with AOF writes | If AOF is not required, set appendonly to no. |
Commands | Time for regular commands (not labeled as fast) | Commands that traverse all data, such as KEYS | Review slow query logs to find long-running commands. Use offline key analysis to check for large keys. |
FastCommand | Time for fast commands with O(1) or O(log N) complexity | Fast commands copying large amounts of data (for example, GET on a large key) | Identify and split large keys. See Identify and handle large keys and hotkeys. |
Fork | Time to call fork() | AOF rewrites | If data persistence is not required, disable AOF by setting appendonly to no. |