ApsaraDB for Redis Enhanced Edition (Tair) supports two instance types: performance-enhanced instances and hybrid-storage instances. Hybrid-storage instances of ApsaraDB for Redis Enhanced Edition (Tair) store data in both memory and disks while in-memory instances store all data in memory. Hybrid-storage instances combine the benefits of memory and disks to provide high read/write performance and persistent data storage.
Hybrid-storage instances of ApsaraDB for Redis Enhanced Edition (Tair) developed by Alibaba Cloud are compatible with the Redis protocol. The instances store full data in disks and hot data in memory to guarantee high read/write performance. Hybrid-storage instances deliver a cost-effective solution to provide high-performance queries for frequently accessed data without the limit of memory capacity.
- Live video streaming
Live video streaming applications generate a large amount of hot data. This type of data is from popular live video rooms. You can use hybrid-storage instances to store data from popular live video rooms in memory and data from infrequently visited rooms in disks. This allows you to make full use of the limited memory capacity.
E-commerce applications generate a large amount of commodity data. You can use hybrid-storage instances to store the data and optimize memory usage. Data of popular commodities is stored in memory and data of less frequently queried commodities is stored in disks.
- Online education
Online education applications generate a large amount of data regarding online courses, question libraries, and messages between teachers and students. Only popular courses and the latest question libraries are frequently queried. You can use hybrid-storage instances to store all data of online courses in disks, and store popular courses and question libraries in memory. ApsaraDB for Redis provides a cost-effective solution to guarantee high read/write performance for frequently accessed data.
The following examples show the benefits of hybrid-storage instances:
- Example 1: A user uses a native Redis cluster to store 100 GB data. The query rate is less than 20,000 queries per second (QPS) at peak hours and 80% of the data is infrequently accessed. In this case, the user can use a hybrid-storage instance of ApsaraDB for Redis Enhanced Edition (Tair) with 32 GB of memory and 128 GB of disk capacity to decrease memory usage by about 70 GB and reduce storage costs by more than 50%.
- Example 2: A user uses an on-premises Pika instance to reduce storage costs caused by a native Redis instance. The total size of the data is approximately 400 GB and only about 10% of the data is frequently accessed. High costs are incurred by cluster O&M. In this case, the user can use a hybrid-storage instance of ApsaraDB for Redis Enhanced Edition (Tair) with 64 GB of memory and 512 GB of disk capacity to ease the burden of O&M while ensuring high service quality.
Select instances for different scenarios
|Scenario||Hybrid-storage instance of ApsaraDB for Redis Enhanced Edition (Tair)||ApsaraDB for Redis Community Edition instance|
|Storage capacity and costs||
||You need to store a small amount of data, or your budget is sufficient for storage costs.|
|Separation of cold data from hot data||Your business data is divided into cold data and hot data.
Note Cold data is the data that is infrequently accessed.
|Your business data is accessed at random.|
|QPS performance and latency requirements for hot and cold data||
|Frequency of accessing large keys||
||Large keys are accessed irregularly and are not affected by latency.|
Select instances based on specifications
When you create a hybrid-storage instance of ApsaraDB for Redis Enhanced Edition (Tair), you must specify the memory and disk capacity. The memory capacity determines the maximum amount of hot data that can be stored and the disk capacity determines the total amount of data that can be stored. ApsaraDB for Redis allocates CPU resources to the instance based on the specified memory and disk capacity. For example, if you specify a master-replica instance with 64 GB of memory and 256 GB of disk capacity, the instance can store up to 256 GB of data, among which 64 GB of data can be cached in the memory.
For more information about the specifications of hybrid-storage instances, see Overview.
- You cannot customize the number of CPU cores.
- Hybrid-storage instances store the metadata of keys in memory and disks. The metadata include the time-to-live (TTL) value, least recently used (LRU) clock value, and type of each key. When you specify the memory and disk capacity, you must reserve capacity to store the metadata. For more information, see the description in this topic.
- Memory capacity
To support more native Redis features, hybrid-storage instances store all keys in memory. The instances store the values of frequently accessed keys in memory and the values of infrequently accessed keys in disks. Therefore, ensure that the specified memory capacity is sufficient to store all keys and related metadata. The following table lists the recommended memory capacity based on the total number of keys.
Total number of keys Recommended memory capacity Less than 20 million 64 GB, 32 GB, and 16 GB 20 million to 50 million 64 GB and 32 GB 50 million to 100 million 128 GB, 64 GB, and 32 GB More than 100 million 128 GB and 64 GBNote The memory capacity determines the CPU resources allocated to the instance when you create the instance. A higher memory capacity indicates higher performance of the instance.
- Disk capacity
ApsaraDB for Redis hybrid storage instances store all data in disks, including the metadata generated for each key. The metadata occupies extra space. Therefore, we recommend that you select a disk capacity that is 1.2 to 1.5 times the actual space required.
Purchase and activate an instance
For more information, see Step 1: Create an ApsaraDB for Redis instance.
The performance of a hybrid-storage instance depends on the instance type and memory hit ratio. This hit ratio indicates the probability that the requested data is found in memory. Higher specifications and a higher memory hit ratio indicate higher performance. If all requested data is found in the memory of the hybrid-storage instance, the performance is the same as that of a high-performance in-memory instance. A lower memory hit ratio indicates lower performance of the hybrid-storage instance. Quality performance is least expected if all requested data is found in disks.
In the following performance tests, the ApsaraDB for Redis instance stores 20 million keys and the size of each value is 1 KB. The GET command is used to read values. Different types of keys are accessed in the following scenarios.
|Test scenario||QPS of a Community Edition instance||QPS of a hybrid-storage instance|
|Keys are accessed at random.||123,000||15,000|
|Based on the Gaussian distribution, 20% of the keys are accessed at a probability of 80%.||120,000||54,000|
|Based on the Gaussian distribution, 1% of the keys are accessed at a probability of 99%.||135,000||114,000|
Hybrid-storage instances of ApsaraDB for Redis Enhanced Edition (Tair) support most native Redis commands. To ensure high performance, hybrid-storage instances have limits on the use of some commands. For more information, see Commands supported by hybrid-storage instances.
OOM error occurred when I wrote data to a hybrid-storage instance. The memory is consumed,
but the disks still have remaining capacity. How can I resolve this issue?
A: The reason for the error is that the memory capacity is insufficient to store all keys and related metadata. Modify instance configurations to increase the memory capacity.