By using the offline key analysis feature to analyze backup files of an ApsaraDB for Redis instance, you can identify large keys in the instance and gain insights into key-related aspects, such as the memory usage, distribution, and expiration time of keys. You can optimize the instance based on the analysis 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
The offline key analysis feature is unavailable for ESSD/SSD-based instances.
If the instance type of an instance has been changed, backup files that are generated before the change cannot be analyzed.
Offline Key Analysis is supported only for Redis data structures and the following self-developed data structures of Tair: TairString, TairHash, TairGIS, TairBloom, TairDoc, TairCpc, and TairZset. If you perform offline key analysis on a Tair instance that uses other self-developed data structures of Tair, the analysis task may fail.
Procedure
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.
In the left-side navigation pane, choose .
By default, the analysis results of the previous day are displayed on the Offline Key Analysis tab. You can specify another time range based on your requirements.
On the Offline Key Analysis tab, click Analyze.
In the dialog box that appears, specify the node and analysis method.
Parameter
Description
Node
The ID of the node on which you want to perform cache analysis.
NoteYou 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 status of the instance.
NoteIf you analyze an existing backup file, make sure that the point in time when the backup file is generated meets your requirements.
Delimiter
The delimiters used to identify prefixes of keys. You do not need to specify the delimiters if you use the following default delimiters:
:;,_-+@=|#
.Click OK.
The system performs analysis and displays the analysis status. You can click Refresh to update the analysis status.
Find the completed analysis task and click Details in the Actions column to view the detailed results.
Basic information: displays the basic information of the instance such as the basic attributes and the cache analysis method.
Related node: displays the memory usage and key statistics on each node of the instance.
NoteThe 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 the instance or node, such as the memory usage and distribution of keys, memory usage and distribution of elements in keys, distribution of key expiration time, and ranking of large keys.
FAQ
What do I do if an error occurs when I analyze keys as a Resource Access Management (RAM) user that does not have the required permissions?
Grant the required permissions to the RAM user and try again. For more information, see ApsaraDB for Redis custom policies.
Some offline key analysis tasks take a longer period of time than other tasks. Why?
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 in the queue, offline key analysis tasks also need to wait.
What do I do if the
decode rdbfile error: rdb: unknown object type 116 for key
error occurs?The backup file cannot be analyzed because the file contains non-standard Bloom filters. Check whether the file contains non-standard Bloom filters.
What do I do if the
decode rdbfile error: rdb: invalid file format
error occurs?The backup file that is selected for analysis is invalid. Check whether a configuration change has been made to the instance after the file is generated. Alternatively, check whether transparent data encryption (TDE) is enabled for the instance. The offline key analysis feature cannot analyze encrypted information.
What do I do if the
decode rdbfile error: rdb: unknown module type
error occurs?The backup file cannot be analyzed because the file contains incompatible data structures of Tair. Check whether the file contains incompatible data structures.
When I create a cache analysis task for an instance, I set the Analysis Method parameter to Create New Backup for Analysis. What do I do if the
XXX backup failed
error occurs?A BGSAVE or BGREWRITEAOF command is being run on the instance. Therefore, the backup file that is used for the cache analysis task cannot be created. We recommend that you create backup files during off-peak hours, and use the latest backup file or historical backup files to create a cache analysis task.
Why is the value of Memory Usage of Keys that is displayed in analysis results smaller than the value of Used Memory?
Cache 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 master-replica replication backlog of the instance.
Related API operations
API operation | Description |
Creates a cache analysis task. | |
Queries the information about a cache analysis task. | |
Queries a list of cache analysis tasks. |