Pit avoidance guide from monomer to serverless


Pit avoidance guide from monomer to serverless

Author|   Alibaba cloud senior technical experts

Reading Guide:The two lines of user demand and cloud development have promoted the rise, development and large-scale application of cloud native technology. This paper will mainly discuss what is a cloud native application, what constitutes a cloud native application, what is serverless computing, and how serverless simplifies technical complexity, helps users cope with rapidly changing needs, and realizes elastic and highly available services, which will be explained through specific cases and scenarios.

Nowadays, all walks of life are talking about digital transformation, especially in new retail, media, transportation and other industries. Digital business form has become the mainstream and gradually replaced the traditional business form. In other industries (such as industrial manufacturing), although the business form of enterprises is not expressed in digital form, under the concept of digital twin, making full use of data technology to optimize production and operation is also becoming a research hotspot and industry consensus.

Enterprises carry out digital transformation from four aspects: means of production, production relations, strategic planning and growth curve:

  • Means of production: data has become the most important means of production, demand / risk changes at any time, and enterprises are facing great uncertainty;
  • Production relations: data centric, non fixed production relations based on processes and rules. Network effects make production relations transcend time and space constraints, and multiple connection modes give birth to new businesses and species;
  • Strategic planning: make decisions based on data and quickly respond to uncertain business environment;
  • Growth curve: digital technology brings the ability to reach a large number of users, which can bring breakthrough growth.

From the perspective of cloud service providers, the evolution trend of cloud. In the era of cloud 1.0, the cloudization of infrastructure is its theme. The cloud hosting mode is adopted, and the applications on and off the cloud remain compatible. Traditional applications can be directly migrated to the cloud. The core value of this mode lies in the flexibility of resources and low cost; After the infrastructure provides massive computing power, how to help users make better use of computing power and accelerate the speed of enterprise innovation has become the core capability of the cloud.

If the basic application is still built on the server, the R & D cost will be very high and the management will be very difficult. Therefore, with cloud 2.0, it is the era of cloud nativity. In the cloud native era, cloud service providers provide rich hosting services to help enterprises with digital transformation and innovation. Users can build applications based on various cloud services like building blocks, greatly reducing R & D costs.

Cloud native application elements

Cloud native applications have three key elements: Micro service architecture, application container and serverless, and agile software delivery process.

1. Microservice architecture

Monomer architecture and micro service architecture have their own characteristics, and the comparison of their main characteristics is shown in the figure below. In general, the single architecture is fast to start, but difficult to maintain. The deployment of micro service architecture is difficult, but it has better independence and agility, which is more suitable for cloud native applications.

Pit avoidance guide from monomer to serverless
Monomer architecture vs microservice architecture

2. Application containerization and serverless

Container is the most popular way of code encapsulation at present. With the help of k8s and its ecological ability, the management difficulty of the whole infrastructure is greatly reduced. Moreover, container provides excellent flexibility and portability in terms of program support. More and more users begin to use container to encapsulate the whole application.   Serverless computing is another form. It does a lot of end-to-end integration and cloud service integration, which greatly improves the R & D efficiency. However, the compatibility with traditional applications is not as flexible as the container, but it also brings great cleanliness. Users only need to focus on the coding of business logic and the innovation of business logic.

3. Agile application delivery process

Agile application delivery process is a very important element, mainly including process automation, focusing on function development, quickly discovering problems, and quickly publishing and launching.

Serverless computing

1. Alibaba cloud function computing

Serverless is a new concept, but its connotation has long existed. The first cloud service of Alibaba cloud or AWS is object storage, which is actually a serverless service in the storage field; In addition, serverless refers to a product system, not a single product. At present, most of the new functions or products launched by cloud service providers in the industry are in the form of serverless. Alibaba cloud’s serverless product system includes computing, storage, API, analysis and middleware. At present, the cloud product system is serverless.

The Alibaba cloud serverless computing platform has four features:

  • Seamless integration with the cloud: seamlessly integrate various cloud services and function computing through event driven mode. Users only need to pay attention to the development of functions, and the triggering of events is completed by the service provider;
  • Real time elastic scaling: the system automatically completes the elastic scaling of function calculation, and the speed is very fast. Users can use this ability in online applications;
  • Sub second level measurement: the sub second level measurement method provides a complete on-demand measurement method, and the resource utilization rate can reach 100%;
  • High availability: the function computing platform has done a lot of work to help users build high availability applications.

So how does alicloud function computing achieve the above four points? The product capabilities of Alibaba cloud function computing are shown in the figure below. First, the function computing product is based on Alibaba’s infrastructure services, and the computing layer on it has been greatly optimized. Then, a large number of capabilities and tools are developed in the application layer. Based on the above product capabilities, users are provided with complete solutions in a variety of scenarios, so as to have the whole excellent function computing product. Function computing is a very basic cloud product of Alibaba cloud. Many products and functions of Alibaba cloud are based on function computing. At present, Alibaba cloud function computing has provided services in 19 regions around the world.

Pit avoidance guide from monomer to serverless
Alibaba cloud functional computing product capability map

2. Serverless helps users simplify the complexity of high availability design and implementation of cloud native applications

The high availability of cloud native applications is a systematic project, including many aspects. The construction of a complete high availability system requires a lot of time and energy. So how does serverless computing help users simplify the complexity of high availability design and implementation of cloud native applications?   As shown in the figure below, the points to be considered in the construction of high availability system include infrastructure layer, runtime layer, data layer and application layer, and each layer has a lot of work to do to achieve high availability. Function calculation mainly focuses on fault tolerance, flexibility, flow control and monitoring to achieve high availability. The functions corresponding to the blue dotted box in the figure below are realized by the platform, which does not need to be considered by users. Although the blue solid wireframe platform has done some work to simplify the work difficulty of users, it still needs users’ attention, and the orange solid wireframe represents some functions that need users to be responsible for. Combined with the functions provided by the platform and some energy investment of users, it can greatly reduce the difficulty of users in the construction of high availability system.

Pit avoidance guide from monomer to serverless
Function calculation high availability

Function computing has been optimized in many aspects to help users build a high availability system. The following figure shows the capability of function calculation in disaster tolerance of availability area. It can be seen from the figure that the function calculation has done the corresponding load balancing, which greatly improves the disaster recovery ability.

Pit avoidance guide from monomer to serverless
Function to calculate multi availability zone disaster tolerance

The following figure shows the asynchronous processing of events by function calculation. Its processing pipeline mainly includes three links: event queue, event distribution and event consumption. Each link can be scaled horizontally. One of the key points is that the distribution of events needs to match the consumption capacity of the downstream. In addition, by specifying different amounts of computing resources for different functions, users can easily and dynamically adjust the consumption speed of different types of events. In addition, the error retry logic can be customized, and there is back pressure feedback and flow control, which will not crush the next service when a large number of requests are generated in a short time.

Pit avoidance guide from monomer to serverless
Asynchronous processing of function calculation events

In terms of observability of function calculation, it provides log collection and query functions. In addition to the default simple log query function, it also provides advanced log query, so that users can conduct log analysis more conveniently. In terms of indicator collection and visualization, function calculation provides rich indicator collection capabilities, and provides views such as standard indicators and overview information, which can be more convenient for users to carry out operation and maintenance work.   The following figure is a schematic diagram of application delivery. In the whole application delivery process, only when each link is done well can we build an agile application delivery process. Its core is automation. Only when automation is achieved can we improve the efficiency and agility of the whole pipeline.

Pit avoidance guide from monomer to serverless
▲ agile application delivery process

The following figure shows the specific tasks of the automated application delivery pipeline in each link. It should be noted that only when the infrastructure is the code can the template be defined and the application running environment be set automatically, so as to realize the continuous integration of automation.

Pit avoidance guide from monomer to serverless
Automated application delivery pipeline

After the application is delivered automatically, it will greatly help the whole R & D efficiency. On the serverless application, alicloud provides a variety of tools to help users implement infrastructure, that is, code. The serverless model has a good ability, that is, the same template can pass in different parameters to generate the definitions of different environments, and then manage these environments automatically.

For the delivery and gray publishing of different service versions of the application itself, function calculation provides service versions and service aliases to provide corresponding services. The gray publishing process of the whole application can be simplified into some API operations, which greatly improves the efficiency of the business. Through these capabilities provided by serverless computing platform, the automation of the delivery pipeline of the whole software application has been greatly improved.

Function calculation also has a very useful function – compatibility with stock applications. Through the custom runtime, many popular frameworks can be adapted and compatible with traditional applications, so that it can be easily adapted to the serverless platform. The console provides a series of services such as application creation, deployment, associated resource management and monitoring.

In addition to function calculation, serverless workflow can also be used to arrange different application links and functions. The workflow can be defined in descriptive language, and each step can be reliably executed by it, which greatly reduces the difficulty of users in arranging complex tasks.

Application scenario case

There are several typical application scenarios for function computing. One is web / API back-end services. Alibaba cloud has many successful application cases, including graphite document, microblog and century Hualian.

Another application scenario of function calculation is large-scale data parallel processing, such as uploading a large number of pictures, audio, text and other data to the OSS, which can trigger the function to do custom processing, such as transcoding, frame cutting, etc. Successful cases in this regard include Hupu, focus media, Baijia Internet, etc.

Another application scenario of function calculation is data real-time streaming processing. For example, when messages and logs generated by different devices are sent to pipeline similar services such as message queue, functions can be triggered for streaming processing.

The last application scenario is the automation of operation and maintenance. Functions are called to complete operation and maintenance tasks by means of timing trigger, cloud monitoring event trigger and process arrangement, which greatly reduces the cost and difficulty of operation and maintenance. Typical successful cases include Tucson future, etc.

Tucson will be an artificial intelligence enterprise focusing on the R & D and application of L4 level driverless truck technology. Tucson will provide driverless truck technology for large-scale commercial operation all over the world and empower the global logistics and transportation industry. During the road test, a large amount of data will be generated, and the processing process of these data is complex and changeable. Even for the same batch of data, different business groups will have different use and processing methods. How to effectively manage different data processing processes and reduce the frequency of human intervention can greatly improve production efficiency.

The irregular operation of road test makes the operation time point and operation duration of process scheduling task have great uncertainty. It is difficult for the local computer room to establish a process management system alone to maximize the machine utilization, resulting in a waste of resources. In the future, Tucson will have many unit business processing scripts and applications locally, but it is unable to migrate to the cloud in full due to various restrictions, which also poses a challenge to how to make rational use of cloud services.

In view of the above situation, Tucson began to explore the automation of data processing platform in the future. Alibaba cloud serverless workflow is billed according to the number of times it is scheduled. It has many advantages, such as easy to use, easy integration, simple operation and maintenance, and can well solve the problems encountered in the above scenarios. It is very suitable for such off-line task scenarios that run irregularly.

Serverless workflow also supports the task of arranging local or self built computer rooms. In the future, Tucson will solve the problem of data access on and off the cloud by using the message service MNS natively supported by serverless workflow, so that the local original tasks can be well arranged and managed.

In addition to scheduling, serverless workflow also supports the maintenance of task status and data generated during execution. In the future, Tucson will use the input-output mapping and status reporting mechanism of tasks to efficiently manage the life cycle of tasks in the process and the data transfer between them.

In the future, with the expansion of business scale, Tucson will continue to optimize the operation efficiency and automation level of offline big data processing process in the future. Through various explorations, Tucson will further improve the efficiency of the engineering team and invest more energy and funds in business innovation in the future.


Serverless workflow is a key part of Alibaba cloud’s serverless product system. Through serverless workflow, users can organize multiple Alibaba cloud services such as function computing and visual intelligence platform, or self built services into workflows in a simple and intuitive way, so as to quickly build elastic and highly available cloud native applications.

Since the function calculation was launched in 2017, the service has expanded and shrunk capacity intelligently in real time according to the change of application load, completed the expansion and contraction of tens of thousands of instances in one minute and guaranteed stable delay. At present, it has supported the key applications of users such as microblog, mango TV, BGI, Tucson future and graphite technology to easily cope with the business peak.

Course recommendation

In order for more developers to enjoy the dividends brought by serverless, this time, we gathered 10 + Alibaba serverless technical experts to create the most suitable serverless open class for developers to learn and use, and easily embrace the new paradigm of cloud computing – serverless.

Click to view the course for free:https://developer.aliyun.com/learning/roadmap/serverless

Alibaba cloud nativeFocus on micro service, Serverless, container, Service Mesh and other technology areas, focusing on cloud native technology trends, cloud native large-scale landing practice, do the best understanding of the official account of cloud developers.

Recommended Today

Java Engineer Interview Questions

The content covers: Java, mybatis, zookeeper, Dubbo, elasticsearch, memcached, redis, mysql, spring, spring boot, springcloud, rabbitmq, Kafka, Linux, etcMybatis interview questions1. What is mybatis?1. Mybatis is a semi ORM (object relational mapping) framework. It encapsulates JDBC internally. During development, you only need to pay attention to the SQL statement itself, and you don’t need to […]