Serverless is a relatively new topic in today’s software world. There is no universally accepted authoritative definition of Serverless, and it may be interpreted differently by each individual and each enterprise, and Serverless continues to grow in this context. But even so, there are some characteristics of Serverless that are widely recognized:

  • Hosts and processes on the server side are completely managed by the vendor
  • It can scale automatically according to the load
  • Billing is based on exact usage, just like water and electricity. (Utility calculation)

Satisfying the above points means:

  • The supplier’s ability evaluation of Serverless service is no longer simply based on resource indicators such as CPU and disk space, but may be based on non-functional indicators such as peak concurrency, real-time performance and so on.
  • Since the server is completely hosted by the vendor without consumer involvement, the vendor should provide high availability guarantees.

I think the above five points are the more important features of Serverless.

Two forms of Serverless

Serverless is actually a concept, and the core of this concept is to de-server. At present, this concept can be realized in two forms:

  • MBaaS (Mobile Backend as a Service) is short for BaaS
  • FaaS (Function as a Service)

BaaS

BaaS is similar in concept to SaaS, but with a smaller granularity of application. It can be understood that BaaS is a micro-service containing a certain function provided by a third party and accessed by users in the form of API. One of the better known ones is Google Firebase. The domestic manufacturer Lean Cloud also provides rich BaaS service capabilities.

At the beginning, BaaS mainly serves mobile application development. In order to enable many mobile application entrepreneurs to focus more on the business of the application end, BaaS emerged as a service form, which greatly improves their production efficiency.

FaaS

FaaS is a function-oriented way to build and deploy software. It was first proposed by Amazon, whose signature product is AWS Lambda.

As with BaaS, the user does not need to manage any server-side resources. In addition, these function processes are not even permanent, but are loaded and run only when needed, and are immediately destroyed. Because of the simplicity of this function-oriented build and deployment, FaaS is very scalable automatically.

The advantages of Serverless

Having briefly introduced the concept of Serverless, why should we use Serverless and in what scenarios is it good to use Serverless?

Common

There are two common benefits:

  1. Reduce operation and maintenance costs.

    Since many server-side host maintenance and process management, even construction and deployment do not require user relationships, which can save a large wave of labor and resource costs.

  2. Green computing, reduce resource waste

    Because the supplier’s services are built on the cloud, the supplier will strive to improve the efficiency of the use of resources for the purpose of maximizing utility. Compared with the current many vendors to maintain host and process, can reduce a lot of unnecessary waste of resources.

BaaS

BaaS also achieves significant savings in development costs by turning over much of its server-side capabilities to third parties.

FaaS

There are two main benefits of FaaS:

  1. Easier to build and deploy

    Because the vendor provides a fairly complete build and deployment solution for FaaS, the developer does not need to do it himself. And the FaaS form itself is relatively simple to build and deploy.

  2. Minimizing the cost of expansion

    This advantage is especially beneficial for irregular spikes in requests. Irregular means that it is difficult for you to develop appropriate strategies to deal with, while FaaS’s convenient automatic expansion ability can deal with such scenarios well, and will not cause a waste of resources.

The disadvantage of Serverless

Having said the advantages, let’s talk about the disadvantages

First, the biggest problem with the current Serverless concept of services, whether BaaS or FaaS, is that they are bound by vendors. For example, if you’re using Lean Cloud’s data storage service and you want to migrate to Google Firebase, their data and programming model could be completely different, and the cost could be huge. These are the things you need to consider.

Second, because the server is hosted by the vendor, you can’t optimize the server for your own needs.

Third, since the nature of the server is cloud computing and the provider is in the utility maximization principle, it is possible for your service to share a physical resource with other people’s services. Multi-tenancy issues can arise, both from a security and performance perspective.

Fourth, security. The more third-party services are called, the more risk points are exposed. On the other hand, if your server relies entirely on third parties, one of the major issues is that you lose a layer of server side barriers. A lot of things that you need to intercept on the server side now you can’t do, and the risk of doing that on the application side is huge.

Finally, there are some unique disadvantages to FaaS:

  1. Quantity explosion

    As you go further, the number of functions you manage may explode. And that means chaos, and more potential for things to go wrong.

  2. Repetitive functional logic

    Different applications may have to write the same set of functional logic. Because it is possible to emit different events but handle them the same way.

  3. stateless

    Since the function process is destroyed immediately after running, the retention of state makes no sense here.

conclusion

For developers, no matter what technology or concept it is, it is essentially a tool for us to implement our business. Therefore, it is necessary to understand all aspects of the tool.

In addition, due to the author’s own practical experience of Serverless is relatively little, if there are any problems in the article, you are welcome to point out.