Performance-enhanced instances of ApsaraDB for Redis Enhanced Edition (Tair) are applicable to scenarios that require high concurrency, many reads and writes on hot data, and higher performance than Community Edition. Compared with ApsaraDB for Redis Community Edition, performance-enhanced instances of ApsaraDB for Redis Enhanced Edition (Tair) provide more benefits. For example, these instances provide enhanced multi-threading performance and integrate multiple Redis modules.
- Fully compatible with native Redis databases. You do not need to modify code in your application when you use ApsaraDB for Redis.
- Provides read and write performance three times that of native Redis databases or ApsaraDB for Redis Community Edition when the same specifications are used. This eliminates the performance limits on high-frequency read and write requests for hot data.
- Requires less response time to process a large number of queries per second (QPS) when compared with native Redis databases.
- Ensures stable performance in high-concurrency scenarios and eliminates connection issues caused by a sudden rise in the number of requests during peak hours.
- Runs full and incremental synchronization tasks in input and output (I/O) threads to accelerate the synchronization.
- Supports standard, cluster, and read/write splitting architectures.
- Integrates multiple Redis modules that are developed by Alibaba Cloud. These modules include TairString, TairHash, TairGIS, TairBloom, and TairDoc. This provides various solutions, simplifies development in complex scenarios, and allows you to focus on your business innovation.
Performance-enhanced instances of ApsaraDB for Redis Enhanced Edition (Tair) can be used in scenarios such as live video streaming, flash sales, and online education. The following section describes the typical scenarios:
- Scenario 1: A flash sales promotion system may process 200,000 QPS or higher for some
cached hot keys. Standard master-replica instances of ApsaraDB for Redis Community
Edition cannot provide high performance during peak hours.
However, performance-enhanced standard instances of ApsaraDB for Redis Enhanced Edition (Tair) can process requests for popular commodities and provide excellent user experience. The performance bottleneck is fixed.
- Scenario 2: Cluster instances of ApsaraDB for Redis Community Edition have limits
on database transactions and Lua scripts.
However, performance-enhanced cluster instances of ApsaraDB for Redis Enhanced Edition (Tair) can provide the required performance and eliminate the limits on cluster commands.
- Scenario 3: If you build an on-premises Redis service with one master node and multiple
replica nodes, the number of replica nodes increases when your workloads increase.
This raises your management and maintenance costs.
Performance-enhanced read/write splitting instances of ApsaraDB for Redis Enhanced Edition (Tair) can provide one data shard and up to five read replicas. This architecture allows you to handle more than one million QPS.
- Scenario 4: If you build an on-premises Redis cluster to process more than ten million
QPS, the number of shards increases as your workloads increase. This raises your management
and maintenance costs.
However, performance-enhanced cluster instances of ApsaraDB for Redis Enhanced Edition (Tair) reduce the cluster size by two thirds and provide a cost-effective choice.
Threading model comparison
|During the process of handling requests, native Redis databases and ApsaraDB for Redis Community Edition must go through the following steps: read requests, parse requests, process data, and then send responses. In this case, network I/O operations and request parsing consume most resources.|
Performance-enhanced instances use multiple threads to process the tasks in these steps in parallel.
ApsaraDB for Redis reads and parses requests in I/O threads, and sends commands through the queues of the parsed requests to worker threads. Then, worker threads run the commands to process the requests and send the responses to I/O threads through other queues.
Performance-enhanced instances support a maximum of four parallel I/O threads. To improve the multi-threading performance, unlocked queues and pipelines are used to transmit data between I/O threads and worker threads.
ApsaraDB for Redis Community Edition and native Redis databases support the single-threading model. The query rate on each data shard reaches 80,000 QPS to 100,000 QPS. Performance-enhanced instances support the multi-threading model. In this model, I/O threads, worker threads, and auxiliary threads process requests in parallel. Each data shard of ApsaraDB for Redis Enhanced Edition (Tair) provides three times the performance of each data shard of ApsaraDB for Redis Community Edition. The following table lists different scenarios that include various types of instances and architectures.
|Standard instances||Community Edition||Not applicable to process more than 100,000 QPS on a single data shard.|
|Enhanced Edition (performance-enhanced instances)||Applicable to process more than 100,000 QPS on a single data shard.|
|Cluster instances||Community Edition||A cluster instance contains multiple data shards. Each data shard provides performance similar to that of a standard instance. If one of the data shards stores hot data and receives a large number of concurrent requests for hot data, the access to other data of this data shard may be delayed. This results in a performance bottleneck.|
|Enhanced Edition (performance-enhanced instances)||Performance-enhanced instances provide high performance to read and write hot data and reduce maintenance costs.|
|Read/write splitting instances||Community Edition||Read/write splitting instances provide high read performance. Instances of this type provide high performance in scenarios where reads are more than writes. These instances cannot support a large number of concurrent writes.|
|Enhanced Edition (performance-enhanced instances)||Performance-enhanced read/write splitting instances provide high performance for reads and support a large number of concurrent writes. This type of instances applies to scenarios that require a large number of reads and writes and reads are more than writes.|
Integrate multiple Redis modules
Similar to open source Redis, ApsaraDB for Redis Community Edition supports multiple native data types, such as strings, lists, hashes, sets, sorted sets, and streams. These data types support common development scenarios, but do not support some complicated scenarios. To manage complicated workloads, you must modify application data, run Lua scripts, or make other required adjustments. The performance-enhanced instances integrate multiple Redis modules that are developed by Alibaba Cloud. These modules include TairString, TairHash, TairGIS, TairBloom, and TairDoc. This provides various solutions, simplifies development in complex scenarios, and allows you to focus on the business innovation.
You can use the TairString module in the following ways:
TairHash is a new data structure module of ApsaraDB for Redis.
A TairHash is a hash. Similar to native Redis hashes, TairHash supports multiple commands and high performance in data processing. For native Redis hashes, you can specify the expiration time only for keys. However, TairHash allows you to specify the expiration time of both keys and fields and specify versions of fields. The improved TairHash features help you simplify the development in most scenarios. TairHash uses an efficient Active Expire algorithm to check the expiration time of fields and delete expired fields. This process does not increase the database response time.
For more information, see TairHash commands.
Note TairHashes are different from native Redis hashes.
TairGIS is a new data structure module of ApsaraDB for Redis.
A TairGIS is a data structure that uses R-tree indexes and supports Geographic Information System (GIS) API operations. The GEO commands of native Redis use one-dimensional indexes and allow you to use GeoHash and Redis SortedSet to query points. Compared with GEO commands, TairGIS uses two-dimensional indexes and allows you to query points, lines, and planes. TairGIS provides more features and can be used to check the intersection or inclusion relationships.
For more information, see TairGIS commands.
TairBloom is a new data structure module of ApsaraDB for Redis.
TairBloom is a Bloom filter that supports dynamic scaling. TairBloom is compatible with all the commands of the RedisBloom module. TairBloom is a space-efficient probabilistic data structure that consumes minimal memory to check whether an element exists. TairBloom supports dynamic scaling and maintains a stable false positive rate during scaling.
For Redis data structures, such as hashes, sets, and strings, you can use bitmaps to achieve similar features as the TairBloom. However, these data structures may consume a large amount of memory, or fail to maintain a stable false positive rate during dynamic scaling. TairBloom can be used to check whether large amounts of data exist. In this case, a certain false positive rate is allowed. You can use the Bloom filter built in the TairBloom without further development or the need to create an extra Bloom filter.
For more information, see TairBloom commands.
TairDoc is a new data structure module of ApsaraDB for Redis.
A TairDoc is a document data structure and fully compatible with RedisJSON. TairDoc supports JSON standards. TairDoc data is stored as a binary tree and simplifies access to child elements of JSON objects.
For more information, see TairDoc commands.
|Data flashback||After you enable data flashback, ApsaraDB for Redis retains append-only file (AOF) backup data for up to seven days. During the retention period, you can specify a time point accurate to seconds. Then, the system creates an instance and restores data to the specific point in time. This ensures the accurate data restoration.|
|Two-way data synchronization||
Data Transmission Service (DTS) supports two-way data synchronization between instances of ApsaraDB for Redis Enhanced Edition (Tair). The synchronization solution applies to scenarios such as active geo-redundancy and geo-disaster recovery. For more information, see Configure two-way data synchronization between ApsaraDB for Redis Enhanced Edition instances.
What can I do if a client does not support the commands for new modules?
You can define the commands for the new modules in code and run these commands. You can also use the TairJedis client that is developed by Alibaba Cloud.