Improving Business Efficiency by 38.89% on Double 11 with Serverless Technology
Step up the digitalization of your business with Alibaba Cloud 2020 Double 11 Big Sale! Get new user coupons and explore over 16 free trials, 30+ bestselling products, and 6+ solutions for all your needs!
Last year, Taobao started adopting serverless for the Double 11 shopping festival and achieved amazing results; and now Alibaba has gradually applied serverless technology to all aspects of the frontend. In this article, we will explain how the serverless technology used in the 2020 Double 11 can help you scale your business in core scenarios.
In app and web development, Node.js is frequently viewed as a valuable weapon, where it plays a flexible and lightweight role in helping to improve business efficiency. Today, Node.js Serverless has expanded its influence from the backend to the frontend. The team at Taobao has been applying Node.js Serverless technology during this year’s Double 11 festival, along with Alibaba Cloud Serverless Function Compute and other infrastructure, at scale in various business scenarios. This year, requests reached new levels, with a peak total of 50,000 QPS, compared to 2,000 QPS of last year, while the CPU level was raised from last year’s average FaaS level of 20% to 40%.
In terms of business value, Node.js Serverless supports the “cloud all-in-one” (云端一体 in Chinese) development model, and delivers an average efficiency improvement of 38.89%. This year, Alibaba relied on the convenience and reliability of Alibaba Cloud Function Compute to quickly apply SSR technology on the landing pages of Taobao, Tmall, and Flying Pig to improve the user experience of these pages. In terms of operation and maintenance, we focused on optimizing the rush state and daily state process to reduce developers’ effort by about 50% when dealing with higher QPS scale. In terms of R&D experience, we built a solution system to reduce the difficulty of R&D and support outsourcing for fast entry.
In the following sections, we will introduce our development solutions and experiences from Double 11, as well as from our daily projects, and provide some real cases of Node.js Serverless based on Alibaba Cloud Function Compute.
Path of Discovery
Midway Serverless Framework
Since the deployment model and runtime environment were different from traditional Node.js applications, we upgraded the existing Node framework and proposed the Midway Serverless framework.
Midway Serverless is a serverless-oriented solution that includes a framework, a runtime, a toolchain, and configuration specifications.
In the framework design process, we focused on the following aspects.
1. Multi-platform adaptability
- Midway Serverless provides the ability to adapt to different cloud platforms and provides the ability to migrate and replace serverless cloud platforms to prevent platform lock-in.
- Provides traditional application mode and serverless mode, with the ability to migrate to each other for downgrading and capacity upgrades.
2. Application layer that is easier to maintain and scale
- Uses Typescript as the base language, defines base classes, and facilitates customization by upper-level application developers.
- Commonly used plug-ins and plug-in systems are provided.
- Provide basic functions such as problem solving and performance optimization.
3. Openness for different business scenarios
- It provides a basic upper-level interface to meet the needs of different developers for customized development based on different business scenarios.
Rapid Trial and Error, Highly Available R&D Model
By unifying the cloud development platform, we were able to build a more agile process for frontend application development from R&D to delivery. We also made a Vscode plug-in and local scaffolding to improve the local development experience for developers.
In terms of the release platform, we built a code cloud by streamlining the release chain, and finally compress the hot-loaded codes into packages. At function runtime, we used hot scheduling mode to speed up the function start time.
At the same time, we worked with various teams from business-side and accumulated various solutions from past practices. The business side can customize its own tenants and can also choose general solutions and combine it with their own gateway.
Model-driven, function-based programming
Driven by models, function scheduling outputs FaaS functions. In combination with the existing building system, developers can schedule modules, build pages, and quickly respond to the business needs related to Double 11.
The technical implementation level is mainly categorized into:
- Data Link Design
- Operator Panel Design
- Code Generation Solutions
The so-called data link design mainly defines DSL by design, which provides structured storage of data sources, models, fields, access parameters, and code fragments.
For example, code fragments are defined as follows.
Operator panel design mainly functions logic programming, as shown below:
FaaS code generation logic:
Provide unitized security
Through remote disaster recovery, services can be deployed in multiple locations and multiple server rooms, to provide multiple services across different locations.
Advantages of unitization:
- Just like changing tires while the vehicle is running at high speed, the frame upgrade can be done in one unit of grayscale.
- When a problem occurs in a single unit, you can switch to another unit to provide services.
- Performance evaluation can be performed on a single unit.
We have connected to a full-link tracking system at the Runtime level of the framework to make it easier for developers to check the link status of errors.
This allows our service teams to focus only on the QPS and success rate of their own business functions. If the success rate drops, or QPS drops, the team will be alerted via IM, SMS or phone.
The following chart shows the daily QPS changes for a function.
Setting up multiple scenarios in advance
In order to cope with unprecedented risks that may exist at each stage of the process, at the architecture level, we ensure that Double 11 goes smoothly by setting up multiple scenarios in advance.
When monitoring alarms occur at any point in the process, a reasonable response can be made.
Based on the traffic in the 2019 Double 11 festival, we estimated the flow scale for this year’s Double 11. We carried out a number of tests, including station building pressure measurement, single-link stress test, and full-link stress test. Based on the stress test performance, we configured flow restriction for each component of the flow link to protect the service.
This year, we were able to squeeze in more CPU consumption at the container level while maintaining the same QPS, which is twice as much as last year.
The upgrades to the development model in 2.2 allow developers to quickly choose from a wide range of common solutions and respond quickly to business needs to produce front-end features that meet business scenarios. Ultimately, the Double 11 virtual venue can realize a wide variety of scenarios with the functionality provided by frontend developers.
SSR: Enabling Double 11 Sessions in Seconds
With SSR server-side rendering + Serverless model, frontend developers can further improve the user experience by optimizing the front and backend together. It helped the Double 11 branch session to significantly improve the page opening speed and also improved the business conversion.
Efficient development of the middle and back-end
The integrated development model for middle and backend has the following features.
- Front and back-end integrated development, go-live, operation and maintenance; efficient development and deployment go-live
- No need to focus on things like servers, domain name applications, etc., users can just focus on business
- Solve long-tail application server cost problems and control the middle and backend lifecycle appropriately.
Serverless is the foundation for the future of software development. Frontend developers can leverage Serverless to deliver business quickly. Whereas in the past, front-end development was often limited by resources, today, driven by creativity, Serverless allows front-end development to be free of resource and cost constraints, while rapidly iterating on the business through the use of Node.js. As a result, development is far more efficient than traditional models, and the cost is relatively low. That’s what we’re continuing to do in front-end development, and the combination of Serverless and multi-tendency technology will lead to a huge leap forward in the entire front-end development model.
We strive to validate our serverless product through continuous practice. By combining Alibaba Cloud Function Compute with the Midway Serverless framework, we can offer our front-end solutions to users and get more people using serverless technology to create the ultimate “cloud-integrated” experience.