This topic describes causes of common latency events and provides suggestions for handling these events.

Background information

Redis 2.8.13 introduced a new feature called latency monitoring to help identify and troubleshoot possible latency issues. The latency monitoring feature allows you to collect data generated only within the previous 160 seconds and access only events that have the highest latency within each second.

Common latency events

Event Description Possible cause Suggestion
EvictionCycle The amount of time consumed for an eviction cycle, which includes the amount of time required to select and delete data and the waiting time of background threads. This event may be influenced by multiple factors. The EvictionDel and EvictionLazyFree events must be analyzed to determine the cause.
  • Check your business data and optimize the data.
  • If evictions frequently occur, we recommend that you scale up your instance to prevent evictions triggered when the occupied memory exceeds the Maxmemory setting.
EvictionDel The amount of time consumed to delete keys during an eviction cycle. This event occurs when large keys are evicted.
  • We recommend that you do not use large keys.
  • Enable asynchronous eviction by setting lazyfree-lazy-eviction to yes.
  • If evictions frequently occur, we recommend that you scale up your instance to prevent evictions triggered when the occupied memory exceeds the Maxmemory setting.
EvictionLazyFree The amount of time consumed waiting for background threads to release memory. This event occurs when the system waits for background threads to release memory until the memory usage is below the Maxmemory setting or the release ends. This occurs if no appropriate keys can be evicted and background threads are releasing memory such as deleting large keys.
  • Modify the memory eviction policy by specifying the maxmemory-policy parameter.
  • If evictions frequently occur, we recommend that you scale up your instance to prevent evictions triggered when the occupied memory exceeds the Maxmemory setting.
ExpireCycle The amount of time consumed for a key expiration cycle. This event occurs when large keys are deleted.
  • We recommend that you do not use large keys.
  • Enable asynchronous eviction by setting lazyfree-lazy-expire to yes.
  • We recommend that you regularly clear expired data in the console.
ExpireDel The amount of time consumed to delete keys during a key expiration cycle. This event occurs when large keys are deleted.
AofWrite The amount of time consumed to write data to append-only files (AOFs). Each time data is successfully written to AOFs, the AofWrite event and one of the AofWriteAlone, AofWriteActiveChild, and AofWritePendingFsync events are recorded. This event may be influenced by multiple factors. The AofWriteAlone, AofWriteActiveChild, and AofWritePendingFsync events must be analyzed to determine the cause. If Persistent Memory (PMEM) is not required, disable AOF persistence by setting appendonly to no.
AofWriteAlone The amount of time consumed for an AOF write. This event occurs when a large amount of data is written or disk-related performance bottlenecks exist.
AofWriteActiveChild The amount of time consumed to write data to AOFs, during which data is also written to disks by other child processes. This event occurs when data is written to disks by other child processes during data writes to AOFs.
AofWritePendingFsync The amount of time consumed to write data to AOFs, during which fsync operations are performed by background processes. This event occurs when fsync operations are performed by background processes during data writes to AOFs.
Commands The amount of time consumed for regular commands that are not labeled as fast. This event occurs when specific commands are run, such as the KEYS command that traverses all data.
  • View slow query logs to identify commands that take long. For more information, see View slow logs.
  • Analyze offline keys to check whether large keys exist. For more information, see Offline key analysis.
FastCommand The amount of time consumed for commands that are labeled as fast. The time complexity of fast commands is O(1) or O(log N). This event occurs when specific commands are run on large keys, such as the GET command that copies large amounts of data.
Fork The amount of time consumed to call fork(). This event occurs during AOF rewrites. If the event is caused by AOF rewrites and PMEM is not required, disable AOF persistence by setting appendonly to no.

For more information, see Diagnosing latency issues.

References