All Products
Search
Document Center

ApsaraDB for Redis:Latency insights

Last Updated:Oct 18, 2023

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 the microsecond. 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 previous 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 full events to be monitored within milliseconds.

  • 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 events, 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.

Billing

This feature is available free of charge.

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.

    For cluster and read /write splitting instances, you can view the statistics of data nodes and proxy nodes.

    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 information about how to troubleshoot issues associated with instance latency, see Suggestions for handling common latency events.

    pqus

    Metric

    Operation

    Event

    The name of the event. Examples: ExpireCycle, EventLoop, Ping, Scan, Commands, and Info. For more information, see the "Common special events" section of this topic.

    Total

    The 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 whose latency is lower than 1 ms. You can click the zhankai icon to view finer-grained statistics, including the numbers of occurrences of the events whose 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 whose latency is from 0 μs to 1 μs is counted and presented under the <1μs category, and the number of occurrences of the event whose 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 whose latency is lower than 2 ms.

    Note

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

Common special events

Category

Event

Threshold

Description

Memory eviction

EvictionDel

30ms

The amount of time required to delete evicted keys in a specific eviction cycle.

EvictionLazyFree

30ms

The amount of time that background threads release the memory in a specific eviction cycle.

EvictionCycle

30ms

The 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 defragmentation

ActiveDefragCycle

100ms

The amount of time required to defragment memory.

Rehash

Rehash

100ms

The amount of time required to perform a rehash.

Data structure upgrade

ZipListConvertHash

30ms

The amount of time required to convert a ziplist to a dictionary by means of hash encoding.

IntsetConvertSet

30ms

The amount of time required to convert an intset to a set by means of set encoding.

ZipListConvertZset

30ms

The amount of time required to convert a ziplist to a skiplist by means of ziplist encoding.

AOF

AofWriteAlone

30ms

The amount of time required to write an append-only file (AOF) as expected.

AofWrite

30ms

The amount of time required to write an AOF. Each time an AOF is successfully written, an AofWrite event and one of the following three events are recorded: AofWriteAlone, AofWriteActiveChild, and AofWritePendingFsync.

AofFstat

30ms

The amount of time required to obtain the information about an AOF.

AofRename

30ms

The amount of time required to rename an AOF.

AofReWriteDiffWrite

30ms

The amount of time consumed by an incremental AOF write performed by a parent process after its child process rewrites an AOF.

AofWriteActiveChild

30ms

The 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.

AofWritePendingFsync

30ms

The amount of time required to write an AOF. A background process may be performing a fsync operation when the AOF is written.

RDB file

RdbUnlinkTempFile

50ms

The amount of time required to delete a temporary Redis database (RDB) file after a bgsave child process is terminated.

Others

Commands

30ms

The amount of time required to run a command that is not tagged with fast.

FastCommand

30ms

The 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 the FastCommands section of this topic.

EventLoop

50ms

The amount of time required to run a main event loop.

Fork

100ms

The amount of time required to call a fork operation.

Transaction

50ms

The actual amount of time consumed by a transaction.

PipeLine

50ms

The amount of time consumed by a multi-threaded pipeline.

ExpireCycle

30ms

The amount of time required to clear expired keys at a time.

ExpireDel

30ms

The amount of time required to delete expired keys in a specific cycle for clearing the keys.

SlotRdbsUnlinkTempFile

30ms

The amount of time required to delete a temporary RDB file from a slot after a bgsave child process is terminated.

LoadSlotRdb

100ms

The amount of time required to load an RDB file from a slot.

SlotreplTargetcron

50ms

The 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 describes FastCommands that are commonly used. For information about other commands, visit the Commands page of the Redis official website. All access control list (ACL) commands tagged with @fast are FastCommands.command

ACCOUNT

ADMINAUTH

ASKING

AUTH

BKLIST

BZPOPMAX

BZPOPMIN

DBSIZE

DECR

DECRBY

DISCARD

ECHO

EXISTS

EXPIRE

EXPIREAT

Get

GETBIT

HDEL

HEXISTS

HGET

HINCRBY

HINCRBYFLOAT

HKCOUNTER

HKSWITCH

HLEN

HMGET

HMINCRBY

HMINCRBYFLOAT

HMSET

HSET

HSETNX

HSTRLEN

INCR

INCRBY

INCRBYFLOAT

LASTSAVE

LLEN

LPOP

LPUSH

LPUSHX

MGET

MOVE

MULTI

PERSIST

PEXPIRE

PEXPIREAT

PFADD

PING

PTTL

PUBLISH

READONLY

READWRITE

RENAMENX

RPOP

RPUSH

RPUSHX

SADD

SCARD

SELECT

SETNX

SISMEMBER

SMOVE

SPOP

SREM

STRLEN

SWAPDB

TIME

TOUCH

TTL

TYPE

UNLINK

UNWATCH

WATCH

XACK

XADD

XCLAIM

XDEL

XLEN

XSETID

XTRIM

ZADD

ZCARD

ZCOUNT

ZINCRBY

ZLEXCOUNT

ZPOPMAX

ZPOPMIN

ZRANK

ZREM

ZREVRANK

ZSCORE

ZSCOREAVG