Author: Wu Xinwei (Xu Ang)

NextRPC is an innovation and exploration of RPC request mode. Like a multi-stage rocket, NextRPC can return multiple segments of data, request/reply multiple segments of data from different network channels, and finally complete the delivery of business scenarios. The word “Next” is a pun:

  1. The core is different from the traditional RPC, the characteristics of the request is to let the request response to the flow of multiple segments back to the client, in the flow of semantic data kept through the Next -> Next -> Next mode to respond;
  2. Next has the meaning of the Next generation, NextRPC is the traditional single response of the Next generation RPC mode.

At present, NextRPC has been launched in some transaction scenarios of Hantao. For example, the order for exchange business will be launched in early April 2021, and the business model has been stable after two promotions in 9.9 and 11.11. In the 2021 Double eleven promotion, through NextRPC link to bring more than 5% uv conversion improvement to the business as a whole, in the multi-commodity selection of an optimal commodity through the scenario, uv conversion improvement of more than 25%.

Business background

In some transaction core links such as shopping cart, order and other scenarios, it is expected to introduce the recommendation algorithm of shopping guide link to make personalized recommendation for single product, multi-product SKU and cross-store scenarios based on store dimensions, and introduce personalized recommended products such as “buy one piece easily” or other preferential information to improve UV conversion rate.

Problems and Challenges

When the core transaction scene meets the collision of personalized recommendation, transaction and shopping guide, the following new problems will occur:

  • Conflicts of user experience: Personalized recommendation algorithm service RT is high, which does not meet the RT requirements of core transaction link;
  • Service quality conflict: the introduction of personalized recommendation will make the downstream system of the transaction link more complex, and bring new challenges to the stability of the system; At the same time, the “personalized recommendation service” of shopping guide link tolerates some uncertainties (such as request timeout/failure), while the “core transaction link” has high requirements on stability and certainty, and every failure may result in missing transactions.
  • Conflict of machine resources: the deployment structure of transaction and shopping guide is different, and machine capacity and distribution are different.

These problems raise new technical challenges: how to support multiple business support systems with different requirements on user experience, quality of service, and resources in a single request.

Technology selection

1. RPC mode analysis

The following is a comparative analysis of five common RPC models:

2. Request processing model analysis

The request processing model mainly analyzes serial processing and parallel processing.

  • Serial processing: the dependency depth of data determines the minimum RT that can be optimized.
  • Parallel processing: By parallelization (concurrency n), rt at the corresponding level is reduced to the original Max (RTn).

3. Multi-segment return mode of NextRPC

NextRPC combines the RPC mode of single request asynchronous push data stream and the request processing model of parallel processing to solve the challenges brought by new business scenarios:

  • Single request asynchronous push data stream:

– Can decouple core business logic from non-core business logic to ensure synchronous response of core data and asynchronous response of non-core data, and solve service quality problems;

– Logical decoupling of trading link and shopping guide link, internal cross-application invocation, solve the problem of machine resources;

  • Parallel processing:

– Service logic can be processed in parallel, saving serial waiting time and solving user experience problems of transaction links.

NextRPC architecture

1. Client architecture

The technical architecture

  • Network layer, smooth Mtop/Accs channel, transparent to services;
  • The data rectification layer, which controls the timing of multiple returns from a single request (where asynchronous sub-returns contain asynchronous business data flows);
  • A data choreography layer that controls the merging of asynchronous data across multiple requests.

Data flow and multiple instances

  • One page supports multiple NextRPC instances. Multiple pages can create multiple NextRPC instances.
  • A NextRPC instance can make multiple different requests and receive different secondary response pushes.

2. Server architecture

The technical architecture

Request process details

  1. The client initiates the main request.
  2. When the server receives the client’s master request and executes business logic, it sends sub-request information through message middleware (note: AttachedRequestEmitter decoups non-core dependencies through message middleware). After the execution of all business logic, the sub-request is also sent.
  3. Returns the client’s primary response, which contains secondary request meta information;
  4. The secondary request receiver consumes the secondary request message through message middleware and invokes the business processor AttachedRequestProcessor. After the business processing is completed, the nextrPC-SDK secondary request processing result is returned.
    1. The secondary response is sent to the client through the message push channel
    2. The client listens to the specified message push channel, and after receiving the secondary response data, renders the screen.

Exception handling

  1. Secondary request orchestration, where a primary request has multiple secondary responses, how does the client know how many secondary requests there are in total?

As the server business calls NextRPC SDK to send a secondary request, SDK knows how many times it has been called, so this information is counted and stored by SDK. SDK internally maintains a secondary request meta information, including the total number and secondary request business information. Every time business invokes SDK to send a secondary request, SDK accumulative total: indicates the total number of secondary requests sent at the end of the primary response.

  1. Secondary request processing. Different services have different throughput. How can multiple services be isolated to ensure non-interference?

Businesses are separated by different topics or tags in messaging middleware, each consumed using a separate thread pool.

  1. How to deal with expired and repeated messages?

The secondary request is sent through the message middleware. When the receiver of the secondary request receives the message, the message is expired and repeated. The SDK provides the meta information of the message (including time stamp and unique identifier).

Message expiration: Internal SDK

Message duplication: Idempotent needs to be implemented by business code based on the unique identity of the request.

3. Technical indicators

As a single request and multiple response RPC mode, NextRPC can be divided into three technical indicators to measure service quality according to the request stage:

  • Master request Success rate: The percentage of master requests processed successfully. The success of the master request determines whether the subsequent process can continue and is also the most basic indicator to measure the service quality of NextRPC.
  • Success rate of secondary requests: The ratio of secondary requests initiated to processed successfully, used to measure the service quality of secondary requests.
  • Secondary response arrival rate: Based on the success of the primary request, the secondary request is initiated, received and processed, and then the secondary response is successfully received by the end device, which is the core measurement index of NextRPC multi-response service quality. With the timeout configuration of the request, the 1s, 3s, and 5s arrival rates can be further measured.

Different request stages have different technical indicators, which can be used to analyze the quality of service of the client and the server. The indicators produced at each stage are shown in the following figure:

Summary and Prospect

Singles Day is alibaba’s super project. 2021 will be the 13th year of singles Day. Based on the technological and business innovations of the past 12 years, it is the beginning of a new cycle.

We from the pursuit of higher to the pursuit of better, technology is also exploring this process, over consumption experience not downgrade this goal, we make bold on core trading link in technology, the pursuit of certainty and trading experience at the same time, provide better and more quality services to satisfy consumers, and can be assigned to the businessman promote operation ability.

In the future, we will continue to try to implement more business scenarios, with the help of NextRPC for business innovation!

We’re hiring!

Welcome to join the Center stage of Taobao Mobile technology. There are a large number of team members, including founders of Ali Mobile middleware, core members of Hawk-Eye full-link tracking platform, and a group of partners who love technology and hope to promote business with technology.

Taobao.com mobile technology is in the middle stage, promoting the upgrade of taobao.com (Taobao, Tmall, etc.) architecture, and is committed to providing basic core capabilities, products and solutions for Taobao.com and the whole group:

  1. Solutions and core capabilities of high availability of services (Application high availability: provides flexible high availability solutions such as adaptive traffic limiting, isolation, and fusing for services, and site high availability: self-healing of faults, multi-room and remote disaster recovery, and rapid cut-flow recovery);
  2. A new generation of business research and development model FaaS (one-stop function research and development Gaia platform);
  3. Implementation and implementation of the next generation network protocol QUIC;
  4. Mobile middleware (API gateway MTop, domain name scheduling AMDC, message/push, file upload AUS, Mobile configuration push Orange, etc.).

Looking forward to joining the basic platform construction of Tao department ~

Resume should be sent to [email protected]

Pay attention to [Alibaba mobile technology] wechat public number, every week 3 mobile technology practice & dry goods to give you thinking!