Author: Wu Peng, technical expert of Alibaba
Introduction:Starting from the daily development process, this paper analyzes the problems that developers have to face in each stage, and then combines solutions to refine the development model for serverless, and makes corresponding with the serverless product form proposed by the industry, so as to provide reference for developers to adopt serverless architecture and services.
In the past two years, the concept of serverless has been exchanged among developers more and more, and the theme sharing shows an explosive trend. For example, in the kubecon & cloudnativecon conference, there were 20 themes about serverless in 2018 and 35 topics in 2019.
At the level of serverless products, from the earliest AWS lambda, to azure functions, Google functions, Google cloudrun, and then to domestic Alibaba cloud serverless kubernetes, serverless application engine, function computing, etc., the Computing Oriented serverless cloud infrastructure is getting richer and richer.
The emergence of new concepts and new products does not appear out of thin air. What they need to solve at the beginning of their birth is the current problems. As practitioners have a clearer and deeper understanding of the problem domain, the solution to the problem will gradually iterate, and solutions closer to the nature of the problem will appear. If you don’t understand the solution from the problem domain, you will easily fall into two extremes: “it can solve all problems” and “it is too advanced to understand”.
Server less from daily iteration
The figure above is a common project iteration model with the goal of meeting customer needs. In this model, the project team usesPassive iterationTo meet the needs of customers, and gradually understand the essence of customer needs, throughActive iterationWork with customers to adopt better solutions or solve problems at root. Each demand feedback will deepen the understanding of customer needs and provide more services to meet the needs. Each bug feedback will deepen the understanding of the solution and provide more stable services.
After the model is launched, the daily core issues are focused onHow to speed up iteration。
If you want to solve the problem of iteration acceleration, you need to know what constraints there are, and have a definite target. The following is the development model from the development perspective:
Although different development languages and architectures will be adopted in practical application, there are common problems in each stage, such as:
In addition to solving the above common problems, we also need to provide standardized solutions to reduce the learning and use costs of developers, and shorten the time from idea to online.
If we analyze the time spent in different stages of the above process, we will find that in the whole life cycle of the project:
- Deployment & operation and maintenance will take much more time and energy than development & testing
- The time and effort of general logic will be close to or even more than that of business logic
In order to speed up the iteration, we need to solve the parts that take up more time and energy in turn, as shown in Figure 4
From left to right, the “deployment & operation and maintenance” cost can be reduced by decentralizing different levels of operation and maintenance work. After reducing the cost of operation and maintenance work, the cost is reduced at the “general logic” level. The two are combined to focus more deeply on the business during the iteration process. This process is also a process from cloud hosting to cloud native, which fully shares the technology dividend brought by cloud native.
Due to the high coupling between software design architecture and deployment architecture and the environment at that time, in the face of new concepts, services and products, the technologies adopted in the iterative process of stock application need to be adjusted, that is, the development and deployment methods need to be modified. For the development and deployment of new applications, the application of new ideas has a certain learning and practical cost.
Therefore, the above-mentioned process can not be achieved overnight. It is necessary to select the matching services and products according to the current business pain point priority, and carry out technical pre research in advance according to the future planning, and select suitable services and products at different stages.
Introduction to serverless
Wikipedia has a complete definition of serverless
Serverless computing is a cloud computing execution model in which the cloud provider runs the server, and dynamically manages the allocation of machine resources. Pricing is based on the actual amount of resources consumed by an application, rather than on pre-purchased units of capacity.
Server free computing is a kind of cloud computing execution model. Cloud vendors provide servers running programs and dynamically manage the allocation of machine resources. Cloud vendors price based on the actual amount of resources consumed by the application, rather than the capacity purchased in advance by users.
In this computing model, the following benefits will be brought to users:
Serverless computing can simplify the process of deploying code into production. Scaling, capacity planning and maintenance operations may be hidden from the developer or operator. Serverless code can be used in conjunction with code deployed in traditional styles, such as microservices. Alternatively, applications can be written to be purely serverless and use no provisioned servers at all.
Server free computing can simplify the process of code deployment to the production environment, and the expansion and reduction, capacity planning and operation and maintenance operations can be transparent to developers. Server free code can be used in combination with code deployed in traditional ways (such as microservices), or developers can write applications in the mode of server free computing without configuring the server in advance
In essence, the concept is the abstraction of the problem domain and the summary of the characteristics of the problem domain. To understand a concept through its characteristics can avoid focusing on the literal description rather than the value of the concept itself.
From the perspective of users, we can abstract the following features of serverless:
- No operation and maintenance (server operation and maintenance, capacity management, elastic scaling, etc.)
- Pay by resource usage
In a company of a certain scale, if the roles of development and operation and maintenance are strictly distinguished, this kind of computing form actually exists and is not a new thing. However, the current technology trend is to reduce the cost of business in the technology side by going to the cloud with the help of the advantages of cloud scale and technology dividend, and feed back the business through the technology dividend. Therefore, the industry’s discussion on serverless focuses on the server less capabilities embodied in the services and products on the cloud.
Serverless development model
From the perspective of architecture, Martin Fowler makes a full exposition of the serverless development model. Here is a simple summary. The core of the article is focused on three points:
- Event driven development model
- Automatic elastic expansion and contraction
The development and application of serverlessEvent driven modelThe architecture is designed around the production and response of HTTP / HTTPS request, time and message. In such a model, the production and processing process of event is the core. The whole service process is driven by event, and the attention is focused on the whole process. The deeper the understanding of business, the more matching between event type and business, and the more effective interaction between technology and business.
Event driven model makesService residencyThis concept is changed from required to optional, which can better cope with the change of business request volume, such as automatic elastic scaling. At the same time, the service is non resident, which can reduce the resource cost and maintenance cost, and accelerate the project iteration.
Through the two pictures of the article, we can understand it more intuitively
Figure 5 shows the current common development model. The click processor service is a resident service that responds to all click requests from users. In a production environment, multiple instances are usually deployed,permanentIs a key feature, the daily operation and maintenance focus on ensuring the stability of resident services.
Figure 6 shows the event driven development model, focusing on the generation and response of events, and whether the response service is resident is an option.
The concept of serverless is different from PAAS (platform as a service) and CAAS (container as a service)Automatic elastic expansion and contractionAs the core feature of the beginning of the concept.
Combined with the development model of event driven, in the serverless scenario, automatic elastic scaling needs to be more transparent to developers, and the focus of developers’ development process on processing capacity has shifted from static to dynamic, so as to better cope with the uncertainty of business requests after online.
In the aspect of development, we can use image or language level packaging (such as war / jar in Java) when delivering, and the platform is responsible for the runtime related work. Furthermore, FAAS concept can be adopted, relying on the platform or standardized FAAS solutions, only business logic functions are provided, and the platform is responsible for the runtime matters such as request entry, request call and automatic elastic scaling.
Regardless of the delivery method, baas concept can be used in the cloud, and some logic can be realized through cloud platform or third-party OpenAPI, such as permission management, middleware management, etc. in the development process, attention is paid to the business level.
Server less service model
The serverless service model focuses on cloud vendors’ support for the computing form of serverless. The main differences between different service and product forms mainly focus on the understanding and satisfaction of serverless features
- No operation and maintenance (server operation and maintenance, capacity management, elastic scaling, etc.)
- Pay by resource usage
In the dimension of no operation and maintenance, the most basic is to eliminate the cost of server operation and maintenance, and developers can apply for resources according to the amount. In the conventional operation and maintenance levels such as capacity management, elastic scaling, traffic management, log / monitoring / alarm, different services and products will focus on adopting appropriate methods to meet their own positioning and target customer characteristics.
On the one hand, cloud manufacturers will determine the charging dimensions according to their own positioning, such as resources and request volume, on the other hand, they will also determine the granularity of charges according to their current technical capabilities.
Through the above analysis, it can be seen that different server less service models of cloud manufacturers are not static, but will grow together with customers with continuous iterations of product positioning, target customer characteristics and technical capabilities.
The server less service model needs to meet the actual needs. Back to figure 4, the server less service models of cloud manufacturers can be divided into the following categories:
- Resource instance platform
- Dispatching platform
- Application management platform
- Business logic management platform
To sum up, they are:
Industry serverless products
At present, both domestic and foreign cloud manufacturers provide serverless products with different dimensions. Here is a brief summary:
Resource instance platform
Foreign AWS fargate / azure ACI and domestic Alibaba cloud ECI / Huawei CCI have great influence and provide container group services to users. The container group as a whole provides a concept similar to pod in kubernetes. Users can directly create container groups through OpenAPI calls, instead of purchasing and configuring servers before deploying services, and delegate resource related capacity management and operation and maintenance work. Users can use the resource instance platform as a resource pool with enough capacity, make fine-grained resource application at the container group level, and manage the application level capacity with dynamic expansion and reduction.
Generally, in the production environment, users usually do not directly use such resource management services, but use application choreography services to make such services transparent and focus on the application choreography dimension.
Kubernetes is the de facto standard for container scheduling. Foreign AWS eks and domestic Alibaba cloud serverless kubernetes, on the one hand, host kubernetes master components, on the other hand, they provide kubernetes node layer services with resource management services, such as virtual kubelet + AWS fargate or virtual kubelet + Alibaba cloud ECI.
For users who want to use kubernetes capability directly, and want to operate and maintain kubernetes at low cost and do not keep resource pool, such products are more suitable for the needs.
Application management platform
Foreign Google gae / cloudrun and domestic Alibaba cloud serverless application engines further service the operation and maintenance work, such as release management (packaging / grayscale / batch / rollback / version control, etc.), log / monitoring / alarm, traffic management, elastic scaling, etc. users can further focus on business requirements and low-cost operation and maintenance.
For the users who expect zero cost transformation of stock application, low learning cost, and want to minimize the operation and maintenance work, this kind of platform has a high matching degree with the demand. However, since there is no standardized solution for the operation and maintenance work at the application management level in the industry, different projects will have personalized needs. Therefore, in the process of adopting such products, it is necessary to strengthen communication, constantly feed back to the platform, and run in the serverless platform and its own business through co construction.
Business logic management platform
On the basis of application management, foreign AWS lambda / azure functions / Google functions, domestic Alibaba cloud function computing / Tencent cloud function / Huawei function workflow, etc., further transparent the general logic in the development process, and users only care about the implementation of business logic. This process can be compared with the unit test writing process in the development process. The input and output are universal, and there are differences only in the processing logic. This kind of serverless products are also the most discussed form in the industry, representing the industry’s abstraction of the ideal development process, which can further speed up the iterative process and shorten the time from ideas to online. This kind of serverless products are more closely integrated with other types of cloud platform products. It uses the services of cloud platform in the form of baas to realize general logic, such as storage and cache, etc., which has a certain implicit demand for the richness of cloud platform products.
The processing process is less dependent on external computing or partial computing scenarios, such as front-end, multimedia processing, etc., using this kind of serverless products is relatively low-cost and easy to use. With the increasing abstraction of services and components, more and more business scenarios will be applicable, and the operation and maintenance work of users will be more transparent. At the same time, the development process can directly enjoy the best practices of the industry, and the stability, performance, throughput and other aspects of the service can be maximized with the help of the platform.
To sum up, when selecting serverless products, users need to sort out the stages and pain points of the current business technology, determine the demand for cloud solutions, and then make corresponding decisions according to the product forms of cloud manufacturers, and then select the services and cloud products suitable for the current stage.
The corresponding relationship focuses on whether the cloud product positioning can meet the business needs for a long time, such as:
- Does the current stage of business technology match the positioning of cloud products
- Will rapid business iteration be limited by the development of cloud products
- How stable are cloud products
- Can cloud products continue to bring technology dividends to the business
At the same time, we also need to know whether cloud products can be accompanied by business development. The focus is on the technical requirements of the business, which are the limitations caused by the positioning of cloud products, and which are the limitations brought by the current technology implementation of cloud products.
If the cloud product positioning brings limitations, then we need to consider the use of cloud products that match the positioning of business requirements. If the current technology is limited, then there is an opportunity to grow together with cloud products and give timely feedback to cloud products, so that cloud products can better meet their own business needs.
In addition, the business level also needs to pay attention to the richness of cloud manufacturers’ own service types. The richer and larger the scale of their own services, the more scale effect will be produced, which will bring more abundant technical dividends and cost advantages to the business.
Fortunately, cloud products usually have rich documents and corresponding user groups. They can directly face product managers and R & D, timely feed back demand, and develop cooperatively with the concept of co construction.
In essence, serverless is a problem domain. It abstracts the problem that non business core affects business iteration in R & D process, and proposes corresponding solutions. This concept is not sudden, we have more or less applied its concept to daily work, but with the wave of cloud computing, the server less services and products on the cloud are more systematic and competitive, and can continuously provide services that meet the business needs based on the advantages of scale and rich product lines.
The concept of serverless not only flourishes in the centralized cloud, but also gradually develops at the edge, which makes the operation of services more extensive, better meet the customers of the business itself, and provide lower delay and stable services.
This article attempts to start from the daily process of project and development, to help readers understand the concept of serverless from the perspective of daily practice, and select appropriate serverless services and products according to the stage. At the same time, the author is responsible for the underlying R & D work in Alibaba cloud serverless application engine, trying to transfer the concept of cloud products and user co construction from the perspective of cloud products, so as to better transfer and create value through collaboration.
- The complete definition of serverless in Wikipedia
- Serverless Architectures
- Event driven model
- From Devops to noops, the landing mode of serverless Technology
- Alicloud elastic container instance ECI
- Alibaba cloud container service ACK
- Alibaba cloud serverless kubernetes (ask)
- Alicloud serverless application engine (SAE)
- Alicloud function computing
- Alibaba cloud serverless workflow
- Cloud Programming Simplified: A Berkeley View on Serverless Computing
In order to enable more developers to enjoy the dividends brought by serverless, this time, we have gathered 10 + Alibaba serverless technical experts to create the most suitable open course of serverless for developers, so that you can easily embrace the new paradigm of cloud computing – serverless.
Click to view the course free of charge: https://developer.aliyun.com/learning/roadmap/serverless
“Alibaba cloud original concerns 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 native developers.”