Does the Serverless architecture need a server?

1.13 head picture.jpg

Author | aoho
source | Serverless official account

What is Serverless?

Does the Serverless architecture eliminate the need for servers? To answer this question, we need to understand what Serverless is.

Serverless architecture has frequently appeared in the speech titles of some technical architecture conferences in recent years. Many people only understand Serverless in a literal sense-serverless architecture, but its real meaning is that developers no longer have to think about servers too much. The problem, of course, this does not mean that servers are completely removed, but we rely on the backend of third-party resource servers. Since 2014, after so many years of development, all major cloud service providers have basically provided serverless services. For example, using Amazon Web Services (AWS) Lambda computing service to execute code.

1.png

The development of domestic serverless services is a little later than AWS, and there is currently support for serverless. Well-known cloud service providers include Alibaba Cloud and Tencent Cloud. The services they provide are also similar: function computing, object storage, API gateway, etc., which are very easy to use.

How did the architecture evolve to Serverless?

Look at the evolution of the cloud computing field in the past few decades. In general, the development of cloud computing is divided into three stages: the emergence of virtualization, the application of virtualization in cloud computing, and the emergence of containerization. The rapid development of cloud computing has been concentrated in the past ten years.

2.png

In summary, there are the following milestones:

  • Virtualize a large physical machine into a single VM resource through virtualization technology.
  • Move the virtualized cluster to the cloud computing platform and only do simple operation and maintenance.
  • Divide each VM into finer Docker containers according to the principle of minimizing running space.
  • Build a serverless architecture based on Docker containers that does not need to manage any operating environment and only needs to write core code.

From the deployment and application of bare metal machines, to the division of Openstack architecture and virtual machines, and to containerized deployment, the typical examples of this are the popularity of Docker and Kubernetes in recent years, which have further developed into the use of a microservice or microfunction to respond to one Client request, this way is the natural process of cloud computing development.

This development process is also an evolution of IT architecture. During this period, it has experienced a series of inter-generational technological changes, which divided resources into more detail, made operation more efficient, and made hardware and software maintenance easier. The evolution of IT architecture mainly has the following characteristics:

  • Less granular hardware resource usage
  • Resource utilization is getting higher and higher
  • Operation and maintenance work gradually reduced
  • Business is more focused on the code level

1. Composition of Serverless Architecture

Serverless architecture is divided into Backend as a Service (BaaS) and Functions as a Service (FaaS) two technologies. Serverless is a server-side logic implemented by developers running in a stateless computing container. It is triggered by events and is completely Managed by a third party.

2. What is BaaS?

Baas translates from English to Chinese meaning: back-end is a service, and its application architecture consists of a large number of third-party cloud servers and APIs, so that the logic and status of the server in the application are managed by the service provider. For example, in our typical single-page application SPA and mobile APP rich client applications, the front-end and back-end interactions are mainly based on RestAPI calls. Only need to call the API of the service provider to complete the corresponding functions, such as common identity verification, cloud data/file storage, message push, application data analysis, etc.

3. What is FaaS?

FaaS can be called: function as a service. Developers can directly deploy service business logic code and run it in a stateless computing container provided by a third party. Developers only need to write business code without paying attention to the server, and the code execution is triggered by events. Among them, AWS Lambda is currently one of the best FaaS implementations.

Serverless's application architecture is an application that combines BaaS and FaaS. Users only need to pay attention to the business logic code of the application, write functions as granularity to run it on the FaaS platform, and integrate with BaaS third-party services, and finally build A complete system. There is no need to pay attention to the server during the whole system process.

Features of Serverless architecture

In general, the serverless architecture has the following characteristics:

  • Achieve fine-grained computing resource allocation
  • No need to allocate resources in advance
  • Have a real high degree of expansion and flexibility
  • Use on demand, bill on demand

Due to the decoupling of serverless applications and servers, the resources purchased are from cloud service providers, making the serverless architecture reduce the pressure of operation and maintenance, and there is no need to estimate and purchase server hardware.

The Serverless architecture enables developers to focus more on the realization of business services, and the middleware and hardware server resources are hosted by cloud service providers. This also reduces development costs, expands and bills on demand, without considering infrastructure.

The serverless architecture also brings convenience to the front end. The cost of the big front end goes deep into the business end is reduced. Developers only need to pay attention to business logic, and front-end engineers can easily turn into full-stack engineers.

What are the application scenarios of Serverless?

Application scenarios are closely related to the characteristics of Serverless architecture. According to these general characteristics of Serverless, we summarize the following typical use scenarios: elastic scaling, big data analysis, event triggering, etc.

1. Elastic scaling

Due to the event-driven and single-event processing characteristics of cloud functions, cloud functions support high business concurrency through automatic scaling. In response to the actual number of business events or requests, the cloud function automatically flexibly handles the appropriate processing instances to carry the actual business volume. When there is no event or request, there is no running instance and no resources are occupied. Such as live video service, the live audience is not fixed, and appropriate concurrency and flexibility need to be considered. The live broadcast cannot be online 24 hours a day, and there are obvious peak and low periods of business visits. Live broadcast is a scene of events or public explosions. The update speed is faster and the version iteration is faster. It is necessary to quickly complete the technical upgrade of new hot spots.

3.png

2. Big data analysis

Data statistics itself only requires a small amount of calculation, offline calculation to generate graphs. The data is processed when it is idle, or when there is no need to consider any delay.

4.png

  • Developers write code, currently supported languages ​​such as Java, NodeJS, Python, etc.;

  • Upload the code to the function calculation, upload through API or SDK, upload through the console page, or upload through the command line tool Fcli;

  • The function calculation execution can be triggered through API&SDK, and the function calculation execution can also be triggered by the event source of the cloud product;

  • During the execution of the function calculation, the dynamic expansion function calculation will be based on the amount of user requests to ensure the execution of the request peak. This process is transparent and imperceptible to the user;

  • The function execution ends.

3. Event trigger

Event triggering means that cloud functions are driven by events. The definition of an event can be a specified http request, or the binlog of the database, message push, etc. Through the Serverless architecture, configure event source notifications on the console and write business code. Business logic is added to the function calculation, and the function calculation will be dynamically scaled during the peak period of the business. This process does not need to manage the software and hardware environment. Common scenes such as videos and OSS pictures. After uploading, through subsequent filtering, conversion and analysis, a series of subsequent processing is triggered, such as illegal content and capacity alarms.

summary

Going back to the beginning of our article, the serverless architecture does not require servers, but relies on third-party cloud service platforms. The server-side logic runs in a stateless computing container, and its business-level state is the database and storage resources used by developers. Recorded.

Serverless serverless architecture has its own application scenarios, but it also has limitations. In general, the serverless architecture is not mature enough, and in many places it is not yet complete. Serverless relies on the infrastructure provided by cloud service providers. At present, cloud service providers cannot achieve real platform high availability. Although serverless resources are cheap, building an application system for a production environment is more complicated.

Cloud computing is still developing, infrastructure services are becoming more and more perfect, and developers will focus more on the realization of business logic. Cloud computing shifts the responsibilities of platform, middleware, operation and maintenance deployment, and also reduces the cost of SMEs going to the cloud. Let us look forward to the future of Serverless architecture.

reference:

  1. Alibaba Cloud Document
  2. https://blog.csdn.net/cc18868876837/article/details/90672971

Guess you like

Origin blog.51cto.com/14902238/2590596