2
头图

Pay attention to the Serverless Official Account Background Reply Manual to unlock and download the entire 2022 Serverless Reference Book in advance!

Introducing the Brick: From Cloud Computing to Serverless

In 2009, UC Berkeley published the article: Above the Clouds: A Berkeley View of Cloud Computing, in which cloud computing was first defined: cloud computing includes application services on the Internet and the hardware and software that provide these services in data centers facility. With the rapid development of cloud computing, the form of cloud computing is also constantly evolving. From IaaS to PaaS to SaaS, cloud computing has gradually "found the correct development direction".


(Development form of cloud computing)

In an article titled Why The Future of Software and Apps is Serverless written by Iron.io's vice president Ken Form in 2012, he put forward a new point of view: even though cloud computing has gradually emerged, everyone is still revolving around it. Rotate the server. This won't last long, though, and cloud applications are moving toward serverless, which will have a major impact on application creation and distribution. And for the first time, the word "Serverless" was brought into the public eye.

By 2017, all major cloud manufacturers have basically made a basic layout in Serverless, especially several major domestic cloud manufacturers, which have also entered the "Serverless era" this year.

From the figure below, we can see that in the evolution from IaaS to PaaS to SaaS, the de-serverization of cloud computing is becoming more and more obvious, so what is the serverless proposed by Ken Form in the previous article? In the process of development of cloud computing, what role is it playing, and how far has it been de-servered?

What is Serverless?

Serverless translated into Chinese means serverless. The so-called serverless does not mean that there is no need to rely on resources such as servers, but that developers no longer need to think too much about servers, and can focus more on product code, while computing resources begin to Appears as a service, not as a concept of a server.

Serverless is a complete process for building and managing a microservices-based architecture, allowing users to manage their application deployments at the service deployment level rather than the server deployment level. The difference from the traditional architecture is that it is completely managed by a third party, triggered by events, exists in stateless, and is temporarily stored (may only exist in the process of one call). In the computing container, serverless deployment applications do not need to be With more infrastructure involved, you can basically automatically build, deploy, and start services.

In recent years, Micro Service (Micro Service) is another hot topic in the field of software architecture. If we say that Micro Service is based on small functional blocks focusing on a single responsibility and function, it uses a modular approach to combine complex large-scale application, then it can be further considered that the serverless architecture can provide a more "code fragmentation" software architecture paradigm, and this part is called Function as a Services (FaaS). The so-called "functions" provide smaller program units than microservices.

For example, the code needed to perform all CRUD operations for a customer can be represented by a microservice, while a function in FaaS can represent every operation a customer wants to perform: create, read, update, and delete. When the "create account" event is triggered, the corresponding "function" will be executed by means of a function. In this sense alone, the serverless architecture can be simply equated with the FaaS concept. But as far as the specific concepts are deeply explored, Serverless and FaaS are still different. The widely accepted relationship between Serverless and FaaS is:

Serverless= FaaS + BaaS (+ .....)

In this relationship, it can be seen that in addition to FaaS and BaaS (Backend as a Service), the composition of Serverless has a series of ellipses.

In the description of the predecessors, the definition of the structure, behavior and characteristics of the serverless architecture can be summarized in the form of the following figure:

"From the definition of composition"

Martin Fowler believes that in the serverless architecture, part of the server-side logic of the application is still completed by the developer, but unlike the traditional architecture, it runs in a stateless computing container, which is driven by events and has a short life cycle (even only once call), managed entirely by a third party, a situation known as FaaS. In addition to this, serverless architectures also have applications that rely in part on third-party (cloud) applications or services to manage server-side logic and state, and these services are the so-called "BaaS" parts.

"By definition of behavior"

CNCF defines the serverless architecture based on the above, and further improves the description:

Serverless refers to the concept of building and running applications that do not require server management. It describes a more fine-grained deployment model in which an application is packaged into one or more functions, uploaded to the platform, and then executed, scaled, and billed in response to the exact needs of the moment.

"From the definition of characteristics"

In 2019, UC Berkeley also supplemented and described what Serverless is from the perspective of Serverless architectural features in the article CloudProgramming Simplified: A Berkeley View on Serverless Computing: Simply put, Serverless = FaaS + BaaS. When a service is considered serverless, it must have the characteristics of elastic scaling and pay-as-you-go;

The concept of serverless is also described in the "Cloud Native Development White Paper (2020)" released by the Cloud Native Industry Alliance of the Academy of Information and Communications Technology: Serverless (ie Serverless) is an architectural concept whose core idea is to provide service resources The infrastructure is abstracted into various services, which provide users with on-demand calls in the form of API interfaces, and truly achieve on-demand scaling and charging according to usage. This architectural architecture eliminates the need for traditional massive continuous online server components, reduces the complexity of development and operation and maintenance, reduces operating costs, and shortens the delivery cycle of business systems, enabling users to focus on higher value-density services. On the development of business logic.

As major manufacturers gradually deploy the serverless field, serverless gradually moves from the enlightenment stage and the market education stage to the further production application and best practice stage, which we will introduce in detail below.

The history of serverless


In the year of 2017 , CNCF Serverless WG was established, and began to promote the rapid development of Serverless with the power of the community, including relevant research and exploration of CNCF Serverless Whitepaper, CloudEvents, etc. At the end of 2017, ChrisJ. Preimesberger of eWEEK published an article Predictions 2018 : Why ServerlessProcessing May Be Wave of the Future to express everyone's views and expectations on Serverless in the "new stage". In this article, many leaders from well-known teams and companies expressed their thoughts on Serverless: Serverless may be the future after containers, and it is foreseeable that Serverless will continue to expand its influence; reshaping the way software is built.

In the 2018 , the development speed of serverless is faster than imagined, and domestic and foreign cloud manufacturers continue to launch new technologies. In the same year, CNCF also officially released a white paper in the field of serverless: CNCF Serverless Whitepaper V1.0, which clarifies Serverless Technical overview, ecosystem status, to guide CNCF's next steps. At the same time, the CloudEvnent specification has entered the CNCF Sandbox.

In this year, UC Berkeley published Serverless Computing: One Step Forward, Two Steps Back, expressing concerns and challenges to Serverless. The author believes that Serverless will block open source service innovation. In fact, any new technology or concept will encounter certain challenges and concerns. Just like when cloud computing appeared, it was considered by some people to be just another concept of commercial hype. Of course, it has also been proved that any new thing , can only grow stronger after experiencing various challenges and doubts.

From 2019 to , Serverless has entered a real production application, and the best practices have developed rapidly. This year is a milestone for Serverless, which is defined by many people as "the element of the official development of Serverless. year".

In this year, there were not only KubeCon's "massive keynote speeches" on Serverless at CloudNativeCon in Shanghai, China, but also UC Berkeley's latest article, Cloud Programming Simplified: A Berkeley View on Serverless Computing.

In this article, after a year of development, UC Berkeley scholars have changed from doubts and pessimism a year ago to self-confidence and expectations, and this article sharply asserts that Serverless will be in the next ten years. Adopted and rapidly developed, it is believed that Serverless will lead the next decade of cloud computing, and the following new perspectives are highlighted:

  • New BaaS storage services will be invented to expand the types of applications that can run on serverless computing more suitable. Such storage can match the performance of local block storage, with both ephemeral and persistent options.
  • More heterogeneous computers than existing x86 microprocessors.
  • More secure and easy-to-use programming, not only has the abstraction ability of high-level languages, but also has good fine-grained isolation.
  • The price based on serverless computing will be lower than serverful computing, at least not higher than serverful computing.
  • Serverless will access more background support services, such as OLTP databases, message queue services, etc.
  • Once serverless computing achieves a technological breakthrough, it will lead to the decline of serverful services.
  • Serverless will become the default computing paradigm in the cloud era and will replace Serverful computing, which also means the end of the server-client model.

In addition to these assertions, Berkeley also gave his own thoughts on what "Serverless" is:

Put simply, Serverless computing = FaaS + BaaS. In our definition,for a service to be considered serverless, it must scale automatically with noneed for explicit provisioning, and be billed based on usage.

It can be seen that from IaaS to FaaS to SaaS to today's Serverless, the development of cloud computing has undergone earth-shaking changes in the past ten years. I believe that with the advent of the 5G era, Serverless will play a role in more fields. critical use.

The best use case for serverless

Serverless architecture is the future evolution direction of cloud native technology, and serverless architecture technology has gradually landed from wait-and-see. According to Gartner's past forecast data, by 2020, 20% of the world's enterprises will deploy serverless architecture. Serverless will further unleash the capabilities of cloud computing, and deliver the security, reliability, and scalability requirements to the infrastructure, so that users only need to focus on business logic instead of specific deployment and operation, which greatly improves the efficiency of application development. At the same time, this method promotes social division of labor and collaboration, and cloud vendors can further optimize computing costs through scale and intensification.

Focus on business core value

With the development of cloud services, computing resources are highly abstracted. From physical machines to cloud servers to container services, computing resources gradually become more refined. Serverless architecture will become an important technical architecture in the cloud computing field in the future, and it will be adopted by more businesses and become its technology selection. Then we will further investigate, in what scenarios can serverless perform very well, and in what types It may not perform very well in the scene? In other words, which scenarios are more suitable for serverless architecture?

The application scenarios of the serverless architecture are usually determined by its characteristics, and the supported triggers determine the specific scenarios.


User scenarios described by CNCF Serverless Whitepaper v1.0

As shown in the figure above, the user scenarios suitable for the Serverless architecture in CNCFServerless Whitepaper v1.0 include:

  • Asynchronous concurrency, scenarios where components can be deployed and scaled independently
  • Respond to sudden or unpredictable service usage scenarios
  • Ephemeral, stateless applications, scenarios that are not sensitive to cold start times
  • For businesses that require rapid development and iteration, because there is no need to apply for resources in advance, the speed of business launch can be accelerated

Based on the characteristics of the serverless architecture, CNCF provides four user scenarios, and also provides detailed examples in combination with common triggers:

  • Execution logic in response to database changes (insert, update, trigger, delete)
  • Analyze IoT sensor input messages such as MQTT messages
  • Process stream processing (analyze or modify dynamic data)
  • Manage a single ingest, transform, and store a lot of processing (ETL) in a short amount of time
  • Cognitive computing via chatbot interface (asynchronous)
  • Schedule short-running tasks, such as CRON or batch calls
  • Machine Learning and Artificial Intelligence Models
  • A continuous integration pipeline that provides resources to build jobs on demand, rather than keeping a build from a pool of hosts waiting for jobs to be dispatched

The above is a theoretical description of the suitable scenarios or services for the serverless architecture. Cloud vendors will describe the typical scenarios of the serverless architecture as a whole from their own business perspective. Usually, the typical application scenarios of object storage as triggers in serverless architecture include video processing, data ETL processing, etc.; API gateways will empower users with external access links and related functions, etc. When the API gateway is used as the When the trigger of serverless related products, the common application scenario is the back-end service, including the back-end service of the app, the back-end service of the website, and even the back-end service of related products such as WeChat applet. At the same time, some smart speakers will also open For related interfaces, this interface can also launch cloud functions through the API gateway to obtain corresponding services, etc.; in addition to object storage triggers and API gateway triggers, common triggers include message queue triggers, Kafka triggers, log triggers, and so on.

Common application scenarios

"Web Application/Mobile Application Backend"

Combining a serverless architecture with other cloud offerings from cloud vendors, developers can build elastically scalable mobile or web applications – easily create rich serverless backends, and these applications can run in multiple data centers with high availability, No administrative work is required for scalability, backup redundancy. For example web application processing example:

(Example of web application backend processing)

"Real-time document/data processing"

In video applications, social applications and other scenarios, the pictures, audio and video uploaded by users tend to be large in volume and high in frequency, which requires high real-time performance and concurrency capabilities of the processing system.

For example, for pictures uploaded by users, multiple functions can be used to process them separately, including picture compression, format conversion, identification of yellow and fear, etc., to meet the needs of different scenarios. E.g:


(Example of real-time file processing)

Through the rich event sources supported by the serverless architecture and the event triggering mechanism, data can be processed in real time with a few lines of code and simple configuration, such as decompressing object storage compressed packages, cleaning data in logs or databases , custom consumption of MNS messages, etc.:

(Example of real-time data processing)

"Offline Data Processing"

Usually, to process big data, it is necessary to build a framework related to big data such as Hadoop or Spark, and at the same time, there must be a cluster for processing data. Through serverless technology, it is only necessary to continuously store the obtained data in the object storage, and trigger the data splitting function through the object storage related trigger to split the related data or tasks, and then call the related processing function. After the processing is completed, stored in the cloud database.

For example: a securities company counts the trading situation of the period every 12 hours and sorts out the top 5 trading volume of the period; processes the transaction flow log of the seckill website every day to obtain errors caused by sold out and analyze the popularity and trends of commodities. The near-infinite expansion capability of Function Compute enables users to easily perform large-capacity data calculations.

Using the serverless architecture, multiple mapper and reducer functions can be executed concurrently on the source data, and the work can be completed in a short time; compared with the traditional way of working, the serverless architecture can avoid the idle waste of resources and save costs. The whole process can be simplified as follows:

image.pnglQLPDhs_cGemDXnMns0DhLAFvBGgvtCDzgI4nJ5hAHAA_900_158.png
(Data ETL processing example)

"Artificial Intelligence Field"

After the AI model is trained, the serverless architecture can be used to provide external reasoning services. By wrapping the data model in the calling function, the code can be run when the actual user request arrives. Compared with traditional reasoning and prediction, the advantage of this is that whether it is a function module or a back-end GPU server, as well as other related machine learning services connected, it is possible to perform pay-as-you-go and automatic scaling, so as to ensure performance and at the same time ensure The stability of the service:

"Internet of Things such as IoT"

At present, many manufacturers are launching their own smart speaker products. Users can say a sentence to the smart speaker, and the smart speaker can pass the sentence to the back-end service through the Internet, and then get the feedback result and return it to the user. Through the serverless architecture, API gateways, cloud functions, and database products can be combined to replace traditional servers or virtual machines.

Through such an architecture, on the one hand, it can ensure that the resources are paid according to the amount, and the function part will be billed only when it is used. It will also perform elastic scaling, which can ensure the stability of the service on the user side. When one of the functions needs to be maintained, it is equivalent to maintaining a single function, and it will not cause additional risks to the main process. Relatively speaking, it will be more secure, stable, etc.:

(example of IoT backend processing)

"Monitoring and Automated Operation and Maintenance"

In actual production, it is often necessary to do some monitoring scripts to monitor the health of website services or API services, including availability and response speed. The traditional method is to use some website monitoring platforms (such as Alibaba Cloud Monitoring, etc.) to provide monitoring and alarm services. The principle of these monitoring platforms is to set the URL to be monitored and the expected time threshold by the user, and the monitoring platform is deployed in various regions. The server periodically initiates requests to judge the availability of the website or service.

Of course, many of these services are popular, and although they are highly versatile, they are not necessarily suitable in practice. For example, now it is necessary to monitor the status code of a website, the delay of different regions, and set a delay threshold. When the website status is abnormal or the delay is too large, an alarm will be notified by email, etc. It is said that most monitoring platforms are difficult to implement directly, so it is particularly important to customize a website status monitoring tool.

In addition, in actual production operation and maintenance, it is also necessary to monitor and alert the cloud services used. For example, when using Hadoop and Spark, it is necessary to monitor the health of nodes; when using K8S, it is necessary to monitor the health of nodes. Monitor multi-dimensional indicators such as API Server and ETCD; when using Kafka, it is also necessary to monitor the data backlog, as well as indicators such as Topic and Consumer; monitoring of these services is often not possible through simple URLs and certain states. To judge, in traditional operation and maintenance, a scheduled task is usually set on an additional machine to perform bypass monitoring of related services.

A very important application scenario of the serverless architecture is operation and maintenance, monitoring and alarming. By combining with timing triggers, it is very simple to monitor and perceive the health status of certain resources, and to build some alarm functions and automate operation and maintenance capabilities. Building:


(Example of website monitoring alarm)

Epilogue

From virtual space to cloud hosting, from self-built databases and other services to cloud databases and other services, cloud computing is developing rapidly, but the future direction and form are vague, and no one knows what the final state of cloud computing is. It is true that some people say that serverless has achieved the original cloud computing goal, and serverless is the real cloud computing, but no one can say for sure that serverless is the final state of cloud computing. Objectively speaking, perhaps, serverless is just a The product of the transition, but this will be left to time to verify.

For more content, pay attention to the Serverless WeChat official account (ID: serverlessdevs), which brings together the most comprehensive content of serverless technology, regularly holds serverless events, live broadcasts, and user best practices.


Serverless
69 声望265 粉丝