The serverless concept aims to build Software as a Service applications more effective.
Maybe you know the "Cloud Stack" and IaaS, PaaS, and SaaS, as the three layers of this stack. The picture below shows which responsibilities are automated by the vendors of IaaS, PaaS or SaaS solutions.
Before serverless the most effective way to build SaaS applications was to develop microservices, deploy them on a Platform as a Service (PaaS) and let the PaaS manage a lot of things.
Using a PaaS you can focus on developing application and deliver software fast. For example, updating operating systems, configuring load balancers, configuring database clusters, etc. are tasks the PaaS takes care of.
With serverless there is another concept which degree of automation is in between PaaS and SaaS. To understand serverless you have to separate the application into two different layers:
- Client: An application that runs in the browser or on a mobile phone and talks to backends which provide an API.
- Server (a.k.a. Backend): A server that handles requests form clients. Those servers mostly provide webservices with a RESTfull API.
Dividing the application layer into client and server and adding the serverless stack to the picture above the new picture looks like this:
The next sections discuss how serverless reduce the time to market and lower the operation costs.
Serverless Purpose 1: Reduce Time to Market
Serverless itself can be divided into two concepts: Backend as a Service (BaaS) and Function as a Service (FaaS).
When using a BaaS you are not building REST-APIs anymore. Instead your client application talks to the database directly with a lean and generic authentication layer in front of the database. Most BaaS solutions also proivde generic data validation mechanisms. Have a look at Usergrid or Baasbox as an example of open source BaaS implementations.
Often an application backend must perform long running asynchronous tasks, this is where Function as a Service (FaaS) comes in. A Function as a Service solution provides you the possibility to upload a piece of code which should be executed on specific events. For example, when a new data record has been inserted into the BaaS.
With the power of AWS Lambda there is the trend to implement everything as a Function (as a service) and using a API Gateway to map http requests to those functions. This means there is no BaaS involved. Data records are proceeded by the functions registered in AWS Lambda. Due to the fact that a AWS Lambda function can execute other Lambda functions there is a risk in ending up in unmaintainable code.
Serverless Purpose 2: Lower Operations Costs
One big advantage of Cloud technologies is that you share resources with others and so you share the costs with others (ressource pooling).
When you use an IaaS layer you must pay the virtual machine yourself, when you are using a PaaS your application runs on the same virtual machine then other people's applications run on. When using SaaS, you share the same application with other people so you share the costs of the whole stack with these people.
When you are using BaaS you share the same BaaS with other users of this BaaS (this might be different for some vendors).