In recent years, the discussion of Serverless technology is extremely hot in the technical circle, and there are many mature cases in the industry. Serverless developed earlier in foreign countries, and the representative ones are Amazon and Google **. In China, both Tencent and Ali define Serverless as the strategic project ** of **** Group, sparing no effort to promote and develop their own Serverless technology.

So what exactly is Serverless?

Why is Serverless the next decade of cloud computing?

First, let’s meet Serverless. Serverless is a back-end architecture technology, or more accurately, a back-end architecture concept or thinking.

You may ask, if it’s back-end architecture, what does that have to do with me as a front-end developer? True, Serverless itself has nothing to do with the front-end, but it is the technology that front-end programmers want to implement most. Many front-end developers, looking forward to its maturity, but many back-end programmers, indifferent or even rejected. Why can appear this one side cold one side hot strange phenomenon? To understand this, we need to start with the history of back-end architecture…

Every B/S architecture of Internet application is composed of the most basic client and server, the client to present the content, it needs the server to provide services. At first, set up a server is very cumbersome, we need to buy a computer host, and then find a room to hosting machine, appearance to take pictures, will be submitted to the registration center to register their hardware parameters, link power and cables, installed the operating system, then builds the running environment of good code, deploy code, Then apply for the domain name and static IP to do a good job of parsing, even if the online deployment completed, this process requires physical action, weight loss effect is very good.

This server architecture is the single architecture of the stand-alone version, database, application code, HTTP server and other services are all run on a server managed by yourself, because we want to contact physical machines, so we also call it the era of physical machines.

In the era of physical machines, online deployment is not only a very tedious problem, but also a variety of problems occur in the operation of the entire application, such as hard disks with track wear, accidental power failure in the machine room, and network cables bitten by rats and so on.

As technology continues to evolve, we have finally moved away from the era of physical machines and into the era of virtual machines. One of the important nodes is the virtualization product for x86 servers introduced by VMWare in 2001. With the virtualization technology, a physical machine can be divided into multiple virtual machines for users to use and make full use of hardware resources. Cloud vendors are responsible for the management of hardware devices. For developers, there is no need to buy hardware, but directly buy virtual machines on cloud platforms, such as AWS EC2, Ali Cloud ECS, Tencent Cloud CVM, etc.

Cloud servers have also really entered the public’s vision, developers no longer need to worry about power outages and hardware failures. However, with the continuous growth of services and more and more users, tens of millions of data are written to the database every day, and the database performance will soon reach the bottleneck. In addition, millions of images are saved to disk every day, and the disk is running low. In order to reduce the load on the server, we migrated the database to the cloud database provided by the cloud vendor and migrated the image storage to the object storage:

The cloud database has a dedicated server and provides backup disaster recovery, which is more stable and provides better performance than installing the database on the server. Object storage can be expanded indefinitely without worrying about running out of disks.

In this way, the server only handles user requests, separating computing from storage, reducing system load and improving data security. In addition, when a single application is upgraded to a cluster application, user traffic is evenly distributed to each server through load balancing.

However, as you expand your server, you will still run into some problems. For example, after the purchase of a server, you need to initialize the software environment and configuration on it, and also need to ensure that all servers run in the same environment, which is a very complicated and error-prone work. This is also a very big challenge for operations engineers.

In general, virtual machines allow you to ignore the underlying hardware, but we still have to pay a lot of money to manage the server cluster. It would be nice to have a technology that kept the server running the same every time a server was expanded. Thus, container technology came into being.

** The release of Docker in 2013 represents that container technology has replaced virtualization technology and cloud computing has entered the container era. ** Container technology is based on virtualization technology, the code and the runtime environment packaged together. This way, the code and the runtime environment remain consistent regardless of the server configuration. With container technology, you don’t have an application deployed on the server, you have a container. When there are too many containers, how to manage becomes a problem, so the emergence of container choreography technology, such as Google open source Kubernetes in 2014, commonly known as K8S.

In the current backend architecture, container technology is still the mainstream server architecture technology, but with the popularity of Internet applications, we need to face a variety of application scenarios.

For example, whenever a big shopping festival comes, our online mall will face a huge traffic peak, while in normal times, the traffic is obviously much lower. In order to meet the traffic peak of the shopping festival, we need to expand a lot of servers. The expansion of servers and the arrangement of a large number of containers is also a no small problem. There is also the risk that servers will go down if we don’t properly estimate the traffic pressure, and in normal times, having so many servers running is a waste of resources and an increase in cost.

So, is there a technology that lets us focus only on the functional implementation of the business code, away from the management of the server? Let us no longer for the operation of the environment, no longer for the expansion of the server capacity in the middle of the night, when the flow peak comes, automatic deployment of more server resources to support, when the flow trough, automatic release of server resources to save costs. Such a wonderful era, is coming to you, it is called Serverless.

To summarize, the history of back-end architecture is actually the history of Serverless. Each era is an abstraction of the infrastructure of the previous era.

The transition from the physical machine era to the virtual machine era, let us no longer care about the management of hardware devices, a real computer into a number of virtual machines isolated from each other. From the virtual machine era to the container era, let us get rid of the complex work of running environment and cluster management, the virtual machine running environment is abstracted into containers. With the advent of Serverless, we no longer care about the deployment of operating environment and server resources.

In the next article, take a closer look at Serverless. See you tomorrow ~