ApsaraDB for Redis provides the latency insights feature in the CloudDBA module to collect latency statistics of all commands that are run and custom events that are executed on databases in an ApsaraDB for Redis instance. The statistics are accurate to microseconds. The latency insights feature allows you to troubleshoot anomalies and performance issues of ApsaraDB for Redis databases.

Overview

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 last 160 seconds and access only events that have the highest latency within each second.

ApsaraDB for Redis provides the advanced latency insights feature. This feature can record up to 27 events and execution durations of all commands, and save all latency statistics within the last three days. For more information about the events, see the "Common special events" section of this topic. The latency insights feature provides the following benefits:
  • Persistent: supports data persistence and latency spike tracing.
  • High-precision: allows all events to be monitored within microseconds.
  • High-performance: supports asynchronous implementations with minimal impact on performance.
  • Real-time: supports real-time data queries and aggregation operations.
  • Multidimensional: provides comprehensive latency data that allows you to analyze an instance based on the event, time, and latency.

Prerequisites

The ApsaraDB for Redis instance uses one of the following minor versions. For information about how to update a minor version, see Update the minor version.
  • Minor version 1.6.9 or later if the instance is an Enhanced Edition (Tair) DRAM-based instance. If you want to collect statistics about Tair module commands, update the minor version to 1.7.28 or later.
  • Minor version 5.1.4 or later if the instance is a Community Edition instance that uses the 5.0 major version.
  • Minor version 0.1.15 or later if the instance is a Community Edition instance that uses the 6.0 major version.
  • Minor version 7.0.0.6 or later if the instance is a Community Edition instance that uses the 7.0 major version.

Procedure

  1. Log on to the ApsaraDB for Redis console and go to the Instances page. In the top navigation bar, select the region in which the instance is deployed. Then, find the instance and click its ID.
  2. In the left-side navigation pane, choose CloudDBA > Latency Insights.
  3. On the page that appears, specify the time range to query and then click Search. By default, statistics of the last 5 minutes are displayed.
    Note Only data of the last three days can be queried, and the time range must span within one hour.
  4. Click the name of an event or a number corresponding to an event in the table. Then, a chart appears and shows the trend of the event-matched metric.
    You can also specify the metrics that you want to view on the chart by selecting the metric names from the drop-down list above the chart.
    Note Only commands or events that take longer than the specified amount of time to run or execute are recorded and displayed. For more information about how to troubleshoot issues associated with instance latency, see Suggestions for handling common latency events.
    pqus
    MetricDescription
    EventThe name of the event. Examples: ExpireCycle, EventLoop, Ping, Scan, Commands, and Info. For more information, see the "Common special events" section of this topic.
    TotalThe total number of occurrences of the event.
    Average Latency (µs)The average latency of the event. Unit: μs.
    Maximum Latency (μs)The maximum latency of the event. Unit: μs.
    Aggregation of Instances (Latency < 1ms)The number of occurrences of the event where the latency is lower than 1 ms. You can click the zhankai icon to view finer-grained statistics, including the numbers of occurrences of the event where the latency is lower than 1 μs, 2 μs, 4 μs, 8 μs, 16 μs, 32 μs, 64 μs, 128 μs, 256 μs, 512 μs, and 1 ms.
    Note Counting method: The number of occurrences of the event where the latency is from 0 μs to 1 μs is counted and presented under the <1μs category. The number of occurrences of the event where the latency is from 1 μs to 2 μs is counted and presented under the <2μs category. Other categories follow the same pattern.

    <2ms

    <4ms

    ...

    >33s

    The number of occurrences of the event where the latency is lower than 2 ms.
    Note Counting method: The number of occurrences of the event where the latency is from 1 ms to 2 ms is counted and presented under the <2ms category. The number of occurrences of the event where the latency is longer than 33s is counted and presented under the >33s category. Other categories follow the same pattern.

Common special events

CategoryEventThresholdDescription
Memory evictionEvictionDel30msThe amount of time required to delete evicted keys in a specified eviction cycle.
EvictionLazyFree30msThe amount of time that background threads release the memory in a specified eviction cycle.
EvictionCycle30msThe amount of time required to perform an eviction. An eviction cycle involves the time required to select and delete data that you want to evict and the time that background threads wait.
Memory defragmentationActiveDefragCycle100msThe amount of time required to defragment memory.
RehashRehash100msThe amount of time required to perform a rehash.
Data structure upgradeZipListConvertHash30msThe amount of time required to convert a ziplist to a dictionary by means of hash encoding.
IntsetConvertSet30msThe amount of time required to convert an intset to a set by means of set encoding.
ZipListConvertZset30msThe amount of time required to convert a ziplist to a skiplist by means of ziplist encoding.
AOFAofWriteAlone30msThe amount of time required to write an append-only file (AOF) as expected.
AofWrite30msThe amount of time required to write an AOF. Each time an AOF is successfully written, AofWrite events and one of the following three events are recorded: AofWriteAlone events, AofWriteActiveChild events, and AofWritePendingFsync events.
AofFstat30msThe amount of time required to obtain status information about an AOF.
AofRename30msThe amount of time required to rename an AOF.
AofReWriteDiffWrite30msThe amount of time consumed by an incremental AOF write performed by a parent process after its child process rewrites an AOF.
AofWriteActiveChild30msThe amount of time required to write an AOF to a disk. Other child processes may write data to the disk when the AOF is written.
AofWritePendingFsync30msThe amount of time required to write an AOF. A background process may be performing a fsync operation when the AOF is written.
RDB fileRdbUnlinkTempFile50msThe amount of time required to delete a temporary Redis database (RDB) file after a bgsave child process is terminated.
OthersCommands30msThe amount of time required to run a command that is not tagged with fast.
FastCommand30msThe amount of time required to run a command that is tagged with fast and has the time complexity of O(1) or O(log N). For more information about such commands, see FastCommands.
EventLoop50msThe amount of time required to have a main event loop running.
Fork100msThe amount of time required to call a fork operation.
Transaction50msThe actual amount of time consumed by a transaction.
PipeLine50msThe amount of time consumed by a multi-threaded pipeline.
ExpireCycle30msThe amount of time required to clear expired keys at a time.
ExpireDel30msThe amount of time required to delete expired keys in a specified cycle for clearing the keys.
SlotRdbsUnlinkTempFile30msThe amount of time required to delete a temporary RDB file from a slot after a bgsave child process is terminated.
LoadSlotRdb100msThe amount of time required to load an RDB file from a slot.
SlotreplTargetcron50msThe amount of time required to load an RDB file from a slot to a temporary database and then migrate the file to a destination database by using a child process.

FastCommands

Note The following table lists commands that are commonly used. For information about other commands, visit Commands | Redis. All ACL commands tagged with @fast are FastCommands. command
ACCOUNTADMINAUTHASKINGAUTH
BKLISTBZPOPMAXBZPOPMINDBSIZE
DECRDECRBYDISCARDECHO
EXISTSEXPIREEXPIREATGet
GETBITHDELHEXISTSHGET
HINCRBYHINCRBYFLOATHKCOUNTERHKSWITCH
HLENHMGETHMINCRBYHMINCRBYFLOAT
HMSETHSETHSETNXHSTRLEN
INCRINCRBYINCRBYFLOATLASTSAVE
LLENLPOPLPUSHLPUSHX
MGETMOVEMULTIPERSIST
PEXPIREPEXPIREATPFADDPING
PTTLPUBLISHREADONLYREADWRITE
RENAMENXRPOPRPUSHRPUSHX
SADDSCARDSELECTSETNX
SISMEMBERSMOVESPOPSREM
STRLENSWAPDBTIMETOUCH
TTLTYPEUNLINKUNWATCH
WATCHXACKXADDXCLAIM
XDELXLENXSETIDXTRIM
ZADDZCARDZCOUNTZINCRBY
ZLEXCOUNTZPOPMAXZPOPMINZRANK
ZREMZREVRANKZSCOREZSCOREAVG