All Products
Search
Document Center

ApsaraDB for Redis:Use the offline key analysis feature

Last Updated:Sep 08, 2023

The offline key analysis feature can analyze backup files of ApsaraDB for Redis and identify large keys in your instances. This feature allows you to view key statistics including the memory usage, distribution, and expiration time of keys. You can optimize your instances based on the analytic results. This feature helps you resolve issues such as insufficient memory and performance degradation that are caused by the skewed distribution of keys.

This feature is provided on top of the cache analysis feature of CloudDBA.

Usage notes

  • This feature is unavailable for ApsaraDB for Redis Community Edition instances that run Redis 7.0 and ApsaraDB for Redis Enhanced Edition (Tair) DRAM-based instances that are compatible with Redis 6.0.

  • If the instance type of an instance has been changed, backup files that are generated before the change cannot be analyzed.

  • The Offline Key Analysis feature is supported only for Redis data structures and the following in-house data structures of Tair: TairString, TairHash, TairGIS, TairBloom, TairDoc, TairCpc, and TairZset.

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 that you want to manage resides. Then, find the instance and click the instance ID.

  2. In the left-side navigation pane, choose CloudDBA > Offline Key Analysis.

    By default, the analysis results of the last day are displayed on the Offline Key Analysis tab. You can specify another time range based on your requirements.

  3. On the Offline Key Analysis tab, click Analyze.

  4. In the dialog box that appears, specify the node and analysis method.

    设置分析节点和方式

    Parameter

    Description

    Node

    The ID of the node for which you want to perform offline key analysis.

    Note

    You can select the entire instance or a specific node for analysis.

    Analysis Method

    The backup file that is used for analysis.

    • Use Recent Backup File: analyzes the most recent backup file.

    • Select a historical backup file: analyzes a historical backup file.

    • Create New Backup for Analysis: creates a backup file and analyzes the file. This allows you to analyze the current state of the instance.

    Note

    If you analyze an existing backup file, make sure that the point in time when the backup file is generated meets your requirements.

    Delimiter

    The delimiter used to identify the prefix of a key based on your requirements. If you want to use one of the default special characters as the delimiter, you do not need to specify this parameter. The default special characters include : ; , _ - + @ = | #.

  5. Click OK.

    The system performs cache analysis and displays the analysis state. You can click Refresh to update the analysis state.

  6. Find the completed analysis task and click Details in the Actions column to view the detailed results.

    • Basic information: displays basic information of an instance such as the instance basic attributes and the cache analysis method.基本信息

    • Related node: displays the memory usage and key statistics on each node of the instance.结果1

      Note

      The Related node section is displayed on the Details page only if the instance is a cluster or read/write splitting instance and the entire instance is selected for the preceding Node parameter.

    • Details: displays the details about an instance or a node, such as the memory usage and distribution of keys, memory usage and distribution of elements in keys, distribution of key expiration time, and the ranking of large keys.缓存分析详情

FAQ

  • Q: What do I do if an error occurs when I analyze offline keys as a Resource Access Management (RAM) user that does not have the required permissions?

    A: Grant the required permissions to the RAM user and try again. For more information, see Grant RAM users permissions to call API operations to analyze full keys offline.

  • Q: Some offline key analysis tasks take a longer time period than other tasks. Why?

    A: As asynchronous tasks, offline key analysis tasks have their time consumption associated with the total number of ongoing tasks in CloudDBA. If a larger than expected number of tasks are waiting, offline key analysis tasks also need to wait.

  • Q: What do I do if a "decode rdbfile error: rdb: unknown object type 116 for key" error occurs?

    A: The backup file cannot be analyzed because the file contains non-standard Bloom filters. Check whether the file contains non-standard Bloom filters.

  • Q: What do I do if a "decode rdbfile error: rdb: invalid file format" error occurs?

    A: The backup file that is selected for analysis is invalid. Check whether the instance has a configuration change after the file is generated.

  • Q: What do I do if a "decode rdbfile error: rdb: unknown module type" error occurs?

    A: The backup file cannot be analyzed because the file contains incompatible data structures of Tair. Check whether the file contains incompatible data structures.

  • Q: Why is the value of Memory Usage of Keys that is displayed in analysis results smaller than the value of Used Memory?

    A: Offline key analysis only parses the amount of memory that is used by keys and their values after serialization in the involved Redis Database (RDB). This is only a part of the memory used by the instance. The memory used by the instance also includes the following parts:

    • The amount of memory that is used by byte alignment, structure variables, and structure pointers corresponding to keys and their values after a jemalloc process. For example, the size of byte alignment, structure variables, and structure pointers corresponding to 250 million keys and their values totals about 2 to 3 GB.

    • The amount of memory that is used by the client output buffer, query buffer, append-only file (AOF) rewrite buffer, and the master-replica replication backlog of the instance.

Related operations

Operation

Description

CreateCacheAnalysisJob

Creates a cache analysis task.

DescribeCacheAnalysisJob

Queries the information about a cache analysis task.

DescribeCacheAnalysisJobs

Queries a list of cache analysis tasks.