Database Autonomy Service (DAS) provides the cache analysis feature that helps you analyze the backup files of ApsaraDB for Redis instances to provide information about the total memory usage and the memory used by each large key. This feature helps you reduce issues such as insufficient memory and performance degradation that are caused by skewed keys. For a master-replica cluster instance of ApsaraDB for Redis Community Edition, the cache analysis feature can provide statistics about the memory usage on each node.
The ApsaraDB for Redis instance for which you want to use the cache analysis feature must be connected to DAS and in the Normal Access state.
The cache analysis feature is unavailable to ApsaraDB for Redis instances of Community Edition V7.0 and Tair DRAM-based instances that are compatible with Redis 6.0.
The cache analysis feature is supported only for Redis data structures and the following self-developed Tair data structures: TairString, TairHash, TairGIS, TairBloom, TairDoc, TairCpc, and TairZset. Other self-developed Tair data structures do not support the cache analysis feature.
If the specifications of an ApsaraDB for Redis instance are changed, you cannot analyze the backup files that are generated before the change.
ApsaraDB for Redis instances that are deployed in the UK (London), Germany (Frankfurt), and India (Mumbai) regions do not support the cache analysis feature.
Log on to the DAS console.
In the left-side navigation pane, click Instance Monitoring.
On the page that appears, find the database instance that you want to manage and click the instance ID. The instance details page appears.
In the left-side navigation pane, choose Request Analysis > Cache Analysis.
In the upper-right corner of the Cache Analysis page, click Analyze.
In the Cache Analysis dialog box, configure the parameters that are described in the following table.
The ID of the node on which you want to perform cache analysis.Note
You can select an instance or a node for analysis.
The mode in which to select the backup files for analysis. Valid values:
Use Recent Backup File: analyzes the most recent backup file.
Create New Backup for Analysis: backs up an ApsaraDB for Redis instance immediately and analyzes the new backup file. This allows you to analyze the current status of the instance.
Select a historical backup file: analyzes a historical backup file.
If you analyze an existing backup file, make sure that the point in time when the backup file is generated meets your requirements.
The delimiters used to identify prefixes of keys. If you use the following default delimiters, you do not need to specify the delimiters:
On the Cache Analysis page, find the analysis task that is created. After the analysis task is complete, click Details in the Actions column. On the page that appears, you can view the analysis results.
Basic Information: In this section, you can view the basic information about the cache analysis, such as the ID of the database instance that is analyzed and the cache analysis method that is used.
Relevant Nodes: If the database instance is a master-replica cluster instance of ApsaraDB for Redis Community Edition, you can view the memory usage of each node in the database instance, such as the total memory usage and the statistics of keys.Note
Relevant Nodes information is displayed only if the cache of a master-replica cluster instance of ApsaraDB for Redis Community Edition is analyzed.
Details: In this section, you can view the total memory usage of the database instance, the statistics that are collected based on keys, such as Avg Daily Increase in Last Week, Total Number of Keys, Memory Usage of Keys, Distribution of Keys, Memory Usage of Elements, Distribution of Elements, Distribution of Key Expiration Time (Memory), and Distribution of Key Expiration Time (Quantity), and the top 100 large keys that are ranked based on memory usage, the number of keys, and prefixes.
Why is the memory usage of keys that are displayed on the Details page less than the actual memory usage of the keys?
The cache analysis feature calculates the amount of memory that is consumed by keys and their values that are stored in Redis database backup (RDB) files after the keys and the values are serialized. The calculated amount of memory accounts for only part of the used memory space. The used memory also includes the following parts:
The amount of memory that is consumed by the struct data, pointers that correspond to the keys and values, and byte alignment. After you use jemalloc to allocate the memory of a database instance, data is aligned based on specific rules. If a database instance contains 250 million keys, the total amount of memory that is consumed by the struct data, pointers, and byte alignment can be approximately 2 GB to 3 GB.
The amount of memory that is consumed by the output buffer, query buffer, and append-only file (AOF) rewrite buffer on your clients, and the amount of memory that is consumed by backlogs. The backlogs are generated during primary/secondary replications.
What are the delimiters that are used as prefixes to distinguish different types of data during cache analysis?
:;,_-+@=|#as delimiters to distinguish data during cache analysis.
Why is the number of elements the same as the length of elements for keys of the String type in cache analysis for an ApsaraDB for Redis instance?
In cache analysis for an ApsaraDB for Redis instance, the number of elements represents the length of elements for keys of the String type.
What do I do if the error
decode rdbfile error: rdb: unknown object type 116 for key XXoccurs?
This error indicates that the ApsaraDB for Redis instance has Bloom keys. You can delete these keys from the instance, or upgrade the instance to Enhanced Edition (Tair) and change the Bloom structure to the TairBloom structure.
What do I do if the error
decode rdbfile error: rdb: invalid file formatoccurs?
This error indicates that the selected backup file is invalid. Check whether the specifications of the ApsaraDB for Redis instance are changed after the backup file is created.
What do I do if the error
decode rdbfile error: rdb: unknown module typeoccurs?
This error indicates the backup file contains self-developed Tair data structures and cannot be analyzed.
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 failederror occurs?
A BGSAVE or BGREWRITEAOF command is being executed 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 memory usage of Stream keys that are displayed on the Details page several times greater than the actual memory usage of the keys?
Stream is a complex data structure that uses radix trees and listpacks under the hood. The cache analysis feature cannot accurately identify the memory usage of such complex data structures, which causes deviations in results.Note
The exhibited deviations are statistical in nature and do not affect the functionality of the database instance.
Related API operations
Creates a cache analysis task.
Queries the details of a cache analysis task.
Queries the information about cache analysis tasks.