Reads:39631Replies:0
[Others]Decoding the Alibaba Cloud Redis technology behind the Double 11 shopping carnival
Abstract: Redis is a widely applied NoSQL database. Alibaba Cloud Redis provides services on the public cloud and in Alibaba Group at the same time. This article introduces some business scenarios of Alibaba Redis during the Double 11 shopping carnival: the storage of hundreds of millions of relationship chains of MicroTao, the cursor paging of comments of Tmall live broadcasting and the order sorting of Cainiao vouchers fulfillment center.
The flourishing Double 11 shopping carnival has concluded, and Alibaba Cloud Redis (ApsaraDB for Redis, the KVStore originally) also accomplished its support for the Double 11 shopping carnival. At present, Alibaba Cloud Redis is available in both stand-alone and cluster versions. • The stand-alone Redis is highly compatible and supports Lua scripts and geographic location computing. • The cluster version has a high capacity and better performance and can break through the performance limit of a single machine which can only run Redis in a single thread. Alibaba Cloud Redis adopts primary/standby architecture with a hot backup mechanism and provides backup recovery support. At the same time, Alibaba Cloud Redis source code team makes constant optimizations and upgrading to Redis to ensure powerful security protection. In this article, we will select some business scenarios from the Double 11 shopping carnival and simplify them for illustration. The real business scenarios are much more complicated than they are in this article. Storage of hundreds of millions of relationship chains of MicroTao The MicroTao community carries the social networking relationships of hundreds of millions of users. Every user has his or her own list of users they follow and every seller has the information of its own followers. The relationship chains across the entire MicroTao are shown in the figure below. ![]() If you adopt a traditional relational database model to express the above relationship information, the business design will be quite complicated, rendering a good performance experience impossible. The MicroTao community adopts Redis clusters to cache the following chains in the community and simplifies the storage of following information while ensuring a smooth shopping experience during the Double 11 festival. The MicroTao community uses hashes to store the following information between users and the storage structure is as follows. It also provides two query interfaces as below: • Whether User A once followed or was followed by User B; • List of User A's active follows; ![]() Cursor paging of comments of Tmall live broadcasting When users are watching live broadcasting on wireless terminals during the Double 11 shopping carnival, they need to refresh the comments for the live broadcasting. There are mainly three models as follows: • Incremental pull-down. That is, to get a specified number (increment) of comments upward from a specified position. • Pull down to refresh. That is, to get a specified number of the latest comments. • Incremental pull-up. That is, to get a specified number (increment) of comments downward from a specified position. The wireless live broadcasting system uses Redis to optimize the business in this scenario, ensuring the success rate of live broadcasting commenting interface as well as 50,000+ TPS and requests of a RT in milliseconds. The live broadcasting system will write two copies of data for every broadcast video, one being the index and the other being the comment data. The index data is of the SortedSet structure, used for sorting the comments, while the comment data is stored in hashes. To get a comment, the index ID is obtained through the index and then the hashes are read to get the comment list. The writing process of the comments is as follows: ![]() After a user refreshes the list, the background needs to obtain the corresponding comment information, using the following procedure: • Obtain the current index position • Obtain the index list • Obtain the comment data ![]() Order sorting of Cainiao vouchers fulfillment center During the Double 11 shopping carnival, after a user generates a trade order, a logistics order will be generated accordingly. For the orders processed by Cainiao warehousing and distribution system, the decision-making system will specify the corresponding order fulfillment plan according to the order information, including when to notice the warehouse, when to discharge the goods from the warehouse, when to collect the express package, and when to deliver the package. The voucher fulfillment center will fulfill the logistic services based on the corresponding time periods in every phase in the fulfillment plan. Because of the limited warehousing and delivery capacities, the vouchers with the earliest expected operation time are deemed with the highest priority. So before the orders are issued to the warehouse or arranged for delivery, they will be sorted by priority. ![]() The order fulfillment center sorts all the logistic orders using Redis to identify the orders with the highest priority. Ending remarks Redis is an outstanding open-source database and provides more convenient data models for developers. Alibaba Cloud Redis is committed to providing stable, high-performance services and we welcome developers to try https://www.aliyun.com/product/kvstore?spm=5176.8142029.388261.36.BOU85T/ services. |
|