All Products
Document Center

Redis support for the November 11 shopping spree

Last Updated: Jan 09, 2018


With the November 11 shopping spree in full swing, ApsaraDB for Redis has proved that that it could provide full assurance to businesses during this important and demanding event. Currently, ApsaraDB for Redis provides a standard single copy, a standard dual copy, and a cluster edition.

The standard single and dual copies feature high compatibility and support Lua scripts and geographic location computation. The cluster edition provides large capacity and high performance, which breaks through the performance limitations of the single-thread, standalone Redis.

ApsaraDB for Redis works in dual-host hot standby mode by default and supports backup and recovery. It is under continuous optimization and upgrade of Alibaba Cloud’s Redis team. It comes with powerful security defense capabilities. Here, we introduce this product using several November 11 business scenarios. These scenarios have been simplified for the purpose of easy understanding.

Storing the social relation for hundreds of millions of users in Weitao Community

The Weitao Community carries social relation for hundreds of millions of Taobao users. Taobao users can specify their followers’ lists and the stores maintain the data of their regular customers or followers. The overall social relation is as follows.

Storing the social relation for hundreds of millions of users in Weitao Community

If a traditional relational database model is used to express the relation chain, this complicates business design and turns out to be inferior performance. The Weitao Community uses a cluster of ApsaraDB for Redis to cache followers chains, which simplifies the storage of followers data and guarantees a smooth business experience during November 11. The Weitao Community uses Hashes to store the relation chains. The storage structure is as shown in the following figure and the following two interfaces are provided for querying:

  • Whether Users A and B are followers of each other

  • List of items User A is following

Social relation storage structure

Paginating comments to a live broadcasting in Tmall

When mobile users view live broadcasts during November 11, they can get more comments to the live broadcasts in three ways:

  • Incremental pull down: Gets a specified number (increment) of comments from the specified position up.

  • Pull-down refresh: Gets a specified number of the latest comments.

  • Incremental pull up: Gets a specified number (increment) of comments from the specified position down.

The wireless live broadcasting system uses Redis to optimize the business scenario. This guarantees not only the success rate for the live comment interface but also over 50,000 transactions per second (TPS) and a request response time in milliseconds. The live broadcasting system writes two sets of the data for each broadcast, indexes, and comments. The indexes are written in SortedSet data structure to sort comments, while comments are stored in Hashes. A comment can be retrieved after an index is used to obtain the index ID, which is used to read the Hashes and to obtain a list of comments. A comment is written in the following process:

Writing a comment to a live broadcasting in Tmall

After a user refreshes the list, the background retrieves the corresponding comments. This process is as follows:

  1. Retrieve the index ID.

  2. Retrieve the index list.

  3. Retrieve the comment.

Comment retrieval process

Sorting orders in Cainiao document fulfillment center

After a user buys an item on November 11, a corresponding logistics order is created, which is to be processed by Cainiao warehouse and logistics system. The decision making system generates an order fulfillment plan based on the order information so that each stage of warehouse and logistics works with each other smartly. The plan specifies the time for issuing the order to the warehouse, the time for outbound delivery, the time for item collection, and the time for delivering the item. The document fulfillment center carries out each stage of logistics services against the fulfillment plan. Owing to the limited capacities of warehouses and logistics, documents to be processed first are orders considered to be of the highest priorities. Therefore, orders are sorted by priorities before being issued.

ApsaraDB for Redis is used to sort logistics orders and to determine their priorities.

Cainiao order sorting