Author: Liu Jinlong (Fu Chen) Gaode team

introduction

"Accident-prone areas ahead, please keep your distance..." "You are driving fatigued, please take a rest..." "The front passes through the Taishan scenic spot, China's 5A-level scenic spot, which is the first batch of national-level scenic spots.. .."  …

This is the navigation scene of AutoNavi Travel. Such heart-warming voice prompts will be tens of billions of times every day during the Spring Festival to ensure your travel safety. However, behind this, any system jitter or failure will affect the user's travel safety, so during the festival, the entire team will stand by and go to the scene to be on duty to ensure the stability of the system.

In the past 2021, AutoNavi Maps has put forward a new brand proposition: in the context of " Map, familiar ", AutoNavi Travel App has added more user usage scenarios, followed by business The system has also become more complex. In order to ensure the stability of the system, during each festival promotion period, colleagues will be on duty on site.

In order to solve this dilemma, we have thought deeply about the system architecture and agreed that serverless will be the future technology trend. Therefore, in the past year, we have done a lot of exploration on serverless technology and implemented some core technologies. Serverless business. Using the advantages of Serverless: low cost, free operation and maintenance, high flexibility, etc., the above-mentioned business has been achieved, and colleagues do not need to be on duty on site during holidays, so that team members can have a peaceful and reunion year at home.

This article will share what explorations AutoNavi has done in the serverless field in the past year? How to combine with business to realize a low-cost, low-code, free operation and maintenance modern serverless R&D platform.

business background

Since July 2021, AutoNavi has announced that it will take on a new brand: an overall upgrade to the "Open Service Platform for Good Life", and at the same time, it has put forward a new brand proposition of "AutoNavi, familiar everywhere". AutoNavi Map has been upgraded from a navigation tool to a travel service platform and a life information service portal; in order to better serve users, the life information service scenarios related to travel are expanded: AutoNavi Maps main map, my page, before and after the trip, and after the trip. The business card method reveals business recommendation information. The following figure shows several typical card recommendation scenarios that appear in the AutoNavi App:



changeable style

One of the business features of AutoNavi is: high-frequency style changes. Under the ever-changing needs of the festive atmosphere, the guidance of holiday travel, the reminder of traffic information, etc., there is an urgent need for a research and development model that can quickly iterate. The traditional research and development model is: each change is developed on the App client, and then the style is updated with the release of the App version. (This kind of release efficiency is very slow, and stability must be considered; one version per month, if you still use this research and development model, it is actually difficult to meet business needs.)

changeable strategy

The back-end code behind the card business will continue to increase with the type of business, so there will be more and more corresponding business strategies. If it is not separated from the system function modules in time, it will be like a tenacious creeper, and the system code will continue to fail. Sequences increase, become more bloated, and become more complex. The changeable strategy will require changes in the system architecture to achieve rapid addition and deletion of strategies, as well as real-time effective.

Client slimming

Combining too much business logic into the client can improve performance to a certain extent, but if the client is too large, it will also cause users to be reluctant to update. In fact, updates of hundreds of megabytes will not only increase our bandwidth costs, but also occupy users' data traffic. In addition, because there is a lot of code, there are also many businesses involved. If every business has the requirement of rapid iteration, this requires the App client to have the ability to update quickly and frequently.

The two constitute a vicious circle, which is not conducive to the long-term development of the App, so it is imperative to lose weight on the client side.

morning and evening peak

During the morning rush hour at get off work and the evening rush hour after work, I believe everyone has had the same experience: congestion! ! In the same map navigation application, the peak time period in the morning and evening is very obvious, and the gap between the peak and the trough is very large. If all machine resources are prepared according to the peak, the cost will undoubtedly be very high. In the low peak period, it will cause extreme Big waste of resources. Therefore, we need elastic resource technology that can be used on demand to reduce the cost of our machine resources.

Technical selection

After many rounds of discussions in the architecture group, we finally reached a consensus goal: fully embrace Serverless. Because of the advantages of serverless, it just solves our business pain point needs. We also believe that the future must belong to the serverless era.

Serverless for frontend

Needless to say, the hottest front-end technology trend is: cloud-integrated R&D model, which is actually a modern application R&D model built on serverless technology as a technical base; it not only lowers the technical threshold for "full-stack development engineers", It has also greatly improved the efficiency of research and development. Many large-scale apps in Alibaba have been used in full, such as Taobao, Tmall, Fliggy and so on. After strict data statistics, Serverless can improve R&D efficiency by 38%, which is also the most important data basis for us to choose Serverless. In addition, the CSR/SSR first screen speed-up technology solution based on serverless has also been very mature, covering almost all of Alibaba's internal App applications.

Iterate quickly

Engineering excellence has always been our pursuit goal, but due to the different focus of major technical products, we have not paid much attention to the "last mile of research and development" related matters, which has led to the separation of the functions of technical products and user experience. Feeling, many business parties give up use.

The goal of Serverless is to let you focus on your own business logic as much as possible, so that you can pay less attention to or ignore non-business core operation and maintenance work; speed up development time and reduce the redundancy cost of online resources, so Serverless is undoubtedly able to withstand This effect of the banner.

fully elastic

Requesting millisecond-level scheduling is the core competitiveness of Serverless. Compared with the traditional minute-level elastic expansion, Serverless technology has a huge cost advantage. The less time it takes to expand, the lower the reserved machine resources. level, there is no need to reserve any resources, so the cost can be greatly reduced, and the resource utilization rate can reach 100%.

Low-cost migration tool - Runtime/Container

Students who have been programmers know that the most painful thing is to "change other people's code". Therefore, although the serverless technology is very attractive, how to migrate the existing applications to the serverless architecture has always troubled us.

How should we solve the problem of unreasonable use of resources by traditional architecture tidal traffic in a low-code way, so we cooperated with the Serverless team to develop Runtime. Since AutoNavi's services are designed in C++, Go, and Rust languages, we have developed C++, Go, and Rust runtimes. Runtime integrates middleware within the group, so that the serverless architecture can meet the entire life cycle of our previous services. Allows us to quickly switch services to the Serverless platform.

However, as our usage increases, the business scenarios become more complex, and some external services cannot use the internal runtime. This serious problem has been hampering us, making the original architecture from simple to complex. Until the students of the Alibaba Cloud Serverless team launched the Custom Runimte/Container function, which completely solved our worries. We can easily migrate existing applications by changing a few lines of startup commands. The serverless team has also done a lot of innovative optimization work for the rapid distribution of images, such as the use of L4 cache, P2P technology, on-demand download, etc., providing the ability to download 3G-sized images in seconds.

Thanks to the support of serverless technology, the goal of unattended operation is easy to achieve. All operation and maintenance operations are solved by the powerful scheduling ability of serverless. It will also scale down Graceful, which does not involve any human operation and maintenance, so this also solves the dilemma that we have too many people on duty during the festival.

Serverless technology landed

Architecture design

In system design, we have introduced two layers of FaaS (Function as a Serverles), side FaaS and business FaaS, among which:

  • Terminal FaaS, also known as SFF (Serverless for frontend), based on Node.js, realizes the integrated development of terminal and cloud, and moves the logic of the original client to the FaaS server. Here, SFF is abstracted between the traditional Frontend and Backend, which is used to realize the encapsulation of data and calling logic for rapid development and release.
  • In the backend, the introduction of business FaaS, based on Java/Go implementation, is used to encapsulate the recommendation strategy logic and data conversion code, which can improve the efficiency of strategy iteration and reduce the impact of strategy iteration on the main project.

On the whole, it is a practical and efficient architectural design idea to integrate function computing and containerized microservices, and comprehensively utilize the efficiency of function computing and the flexibility of traditional microservices.

Iterate quickly

As the core application, a complete CI/CD process is required to ensure the quality of the application. For the quality of the function, we have also implemented a complete R&D process solution based on the Serverless Devs tool chain. Not only does it have the capabilities of multi-function environment, function gray cut flow, and function observability, but also through this serverless R&D system, we have realized the ability to start development in 1 minute and complete the launch in 5 minutes. .

Current limit and downgrade, live more in different places

For the stability of high-traffic applications, current limiting protection, downgrade plan, and remote multi-activity are three essential functions. Especially during big promotions, unexpected traffic may cause system avalanches. On our serverless R&D platform, Alibaba Cloud's function computing concurrency flow control and QPS flow control capabilities are integrated to achieve function-level flow control. .

Another highlight is that the disaster recovery solution of FaaS has huge advantages compared with the disaster recovery solution of traditional applications. In the disaster recovery solution of traditional applications, redundant machine resources need to be prepared in the spare room for multi-active activities in different places. These resources are also the cost. However, in the solution in the serverless scenario, because it is fast and elastic, resources can be completed in seconds. Therefore, there is no need for resource redundancy preparation, which greatly saves costs. Although it is a three-unit, the cost is still the cost of one unit. At present, for all core function applications, we have implemented three-unit disaster recovery by default.

6.png

Cold start optimization

If your business is very sensitive to cold start, such as 50~100 milliseconds of delay increase, and you can't accept it, don't worry, we can still make up for it through the expansion strategy: reserve resources to reduce the impact of cold start on the business.

  • For reserved instances, based on the product flow curve, it is easy to figure out what the fixed flow is. This part of the traffic uses the "reservation mode", which is suitable for cold-start sensitive services;
  • In the capacity expansion mode, the capacity is expanded according to the concurrency or CPU utilization threshold set by the user. The instance being expanded will not receive traffic immediately, but will be serviced after the instance is Ready. Therefore, the newly added traffic during the expansion will still be dispatched to the "in-service" instance, and will not trigger a cold start.

Outlook

In the past 2021, AutoNavi has explored many directions in the serverless field, and has also realized the serverlessization of some core businesses. The peak QPS of serverless business alone has exceeded 40W QPS, but this is not the end, it is just the beginning, and we will turn to serverless in the future. For example, offline non-online applications such as map data processing, image cropping, message consumption, etc. are also the best applicable scenarios for serverless. We hope that there will be more scenarios to use serverless in the future and enjoy the benefits of serverless. Technology dividends!

Recently popular

# Getting Started with Serverless #

As the popularity of serverless continues to increase, more and more people expect to get started quickly in actual work. In order to allow more serverless beginners to truly learn the theoretical knowledge of serverless and flexibly apply serverless technology in their work as needed, the Alibaba Cloud serverless team has launched the technical map . This course includes video lessons, hands-on experiments, e-books, live broadcasts, and open source projects. Various forms of content allow developers to learn and use immediately, and enjoy the benefits of Serverless technology when running. Click here ​to learn!


阿里云云原生
1k 声望302 粉丝