Different from single-thread Redis databases, performance-enhanced ApsaraDB for Redis instances support multi-threading, tripling the QPS value of single-thread Redis databases.
In a process of handling requests, traditional Redis databases must go through the following steps: read requests, parse requests, process data, and send responses. During the process, network I/O operations and request parsing consume most of the resources. ApsaraDB for Redis instances of enhanced performance split tasks in each step, and use multiple threads to process the corresponding tasks simultaneously.
- I/O threads are used to read requests, send responses, and parse commands.
- Worker threads are used to process commands and timer events.
- Auxiliary threads are used to monitor the status of shards and heartbeats.
The following figures show the differences between a single-thread architecture and a multi-thread architecture.
After ApsaraDB for Redis reads and parses requests from users in I/O threads, the parsing results are queued as a list of commands and forwarded to worker threads for processing. Worker threads process commands and forward generated responses to I/O threads by using other queues.
Performance-enhanced instances support a maximum of six I/O threads to run simultaneously. To improve the performance in parallel processing, unlocked queues and pipelines are used to transmit data between I/O threads and worker threads.
|What are performance-enhanced ApsaraDB for Redis instances?||Describes the features, scenarios, and billing methods of performance-enhanced ApsaraDB for Redis instances.|
|Specifications and performance||Describes the specifications of performance-enhanced ApsaraDB for Redis instances.|