By Hao Nan
Alibaba Cloud Redis is a powerful key-value (KV) cache database that is easy to use as well as secure and stable. Alibaba Redis can be used in a variety of business scenarios to provide low latency and query optimization. This article specifically details the methods and solutions that Redis can provide in single data, multi-source, and ultra-high concurrent access scenarios.
In business scenarios where there are tens of millions of daily active users and millions of online users, if frontend access is directly loaded to the backend database, the underlying database may be overwhelmed instantly. This can in turn lead to interruptions to your business operations. Or, as the number of query conditions increases and the conditions become more complicated, the response time of the query results cannot be guaranteed, resulting in a decline in user experience and lost customers. Redis is designed specifically to serve as a solution to these problems by allowing you to simultaneously meet your high concurrency and low latency requirements.
This is a business scenario for online House searching. A large number of query conditions lead to a complex query SQL in the background. However, is all of this necessary to use Redis in this scenario? The answer is no. Due to the low concurrency of online house searching business, customer requirements for the response time are not so demanding, and most requests can be temporarily queried directly through dynamic SQL. But, the query results of some hotspots can be pre-cached in Redis to improve the user experience.
This is a video query system for a video application. This is a similar business scenario as the house searching system, but the concurrency is several orders of magnitude higher. Redis in this scenario is well suited to be used as a cache to increase concurrent access and reduce the response time to meet the concurrent access requirements of hundreds of thousands or even millions of online users. This is one of the fundamental factors for determining whether to use Redis are the concurrency and latency requirements. The following sections discuss how Redis meets concurrent access requirements under other extreme Internet scenarios.
This is a typical media cache architecture diagram. The posting system updates the media library from time to time, and synchronizes the latest articles to the Redis cache through the distributed cache service. The frontend application finds the corresponding data source to access through the routing layer. Data of each cache service is not synchronized. In the event of a hotspot event, the routing layer may route the access from inaccessible regions to the cache server where the hotspot data is located, causing instantaneous traffic surge, which may lead to server downtime and negatively impact the business in extreme cases. So how to deal with this irregular traffic surge scenario?
Here are several methods:
With the first method, the hotspot data can be effectively scattered, but hot events occur randomly from time to time, resulting in high O&M pressure and high costs. Therefore, this method does not solve the fundamental problem.
With the second method, the cache capacity can be improved by appending a local cache. However, how large the local cache is set, how often it is refreshed, and whether the business can tolerate dirty reads are all issues that cannot be avoided. With the third method, read-only copies can be appended to realize data replication, but it also brings high cost and high load on the master database.
The diagram of the architecture shown above is an optimized solution, which pulls multiple branches of read-only slave databases through the master database, and divides independent cache services for different request sources. For example, the mobile app access is routed to the APP data resource group, and the WEB access is routed to the WEB data resource group. Each resource group can provide N read-only copies to improve concurrent access capability under the same source access. This architecture can improve the resource isolation capability of different access sources, and improve the stability and availability of businesses under the multi-source access.
However, this method has the following problems:
Among Alibaba Cloud Redis customers, the most complex architecture is one with 1 master and 40 read-only copies that are used to meet similar business scenarios.
Alibaba Cloud has launched the performance enhanced version of Redis. This version greatly improves the read/write performance of a single Redis node by improving the concurrent processing capabilities of the network I/O.
Compared with the community version of Redis, the performance enhanced version offers three times better performance. Because this version maintains the processing mode of a single Worker thread, it is fully compatible with Redis protocol. The above single data access capability of million QPS can be easily achieved.
For the media scenarios introduced in this article, the 200w+ QPS for single data can be realized by enabling the performance enhanced version of Redis with 1 master and 5 read-only copies. This can effectively alleviate the industry pain points described in the previous section, especially, such as traffic surges and ultra-high concurrent access caused by unexpected hotspot events. Compared with the community version of the on-premises Redis (1 master and 40 read-only copies), the architecture of Alibaba Cloud Redis performance enhanced version (1 master and 5 read-only copies) with the same performance standards is more stable, easier to manage, and more convenient to use.
Check out the enhanced performance version of Alibaba Cloud Redis for yourself.
kehuai - May 15, 2020
Alibaba Clouder - July 1, 2020
Alibaba Clouder - December 21, 2020
Alibaba Cloud Storage - May 8, 2019
Alibaba Cloud Storage - November 8, 2018
Alibaba Container Service - August 25, 2020
Leverage cloud-native database solutions dedicated for FinTech.Learn More
Migrating to fully managed cloud databases brings a host of benefits including scalability, reliability, and cost efficiency.Learn More
An easy transformation for heterogeneous database.Learn More
A tool product specially designed for remote access to private network databasesLearn More
More Posts by ApsaraDB