Stupid question of the day #2: What is Serverless and what is has to do with cloud?

Since I’ve been getting involved into the cloud computing world, I’ve been hearing a lot of new concepts: serverless is one of them. In this post I’ll explain in my own words what are the key concepts behind this new technology in the cloud computing world.

Because there are a lot of concepts involved, this post will also be extended to a couple more that will cover the whole subject. Please feel free to come back to read on the next days, so you get the whole idea on this new model.

First a bit of context…

During the history and growth of computing infrastructure of IT industry we have seen an evolution from physical servers, virtual machines, followed IaaS and PaaS models, and recently hearing about an stateless and autoscaling infrastructure which is called Serverless also known as Function as a Service model.

On this diagram is shown how each part of the pipeline of a software system in the cloud is concerned to the vendor or customer part.

Cloud computing technologies abstraction *

How all this happened?

Long time ago, when we started to use hardware virtualization; this brought a lot of benefits for scaling systems inside companies and their private networks. Therefore having the possibility to outsource the hardware layer management to a third party provider.
Later on, the cloud computing based architecture started with the Infrastructure and Platform as service models. These options are offering to make even more independent services without having to worry at all about the servers provisioning and maintenance of the infrastructure that software applications need.

But once the provisioning is done and the servers are ready to take requests in the cloud, clients need to pay for this infrastructure even they use it or not, with zero or hundreds of requests.

This makes the PaaS model, in general a great option for startups but, which in some cases becomes quite expensive once the number of requests starts to increase as they grow.

Cost is always something that drives companies to ways to make this cheaper. Which take us to the Serverless cloud computing model.

Serverless stands for a cloud model where you only pay by the time your code is actually executed on the cloud infrastructure. Thus you will only pay for the fractions of seconds and the number of requests that are made to the listener service that triggers your code to be executed. This also makes the infrastructure stateless, which means it always runs in a fresh environment for every invocation. Even if the container is reused in a subsequent call, the filesystem is renewed.

Serverless computing doesn’t imply that there are no servers where your code is running. But a model where the server-side code is run is stateless, event-triggered and compute containers that are fully managed by a third party provider.

The most known providers of this new model are technologies such as AWS Lambda, Azure Functions, IBM OpenWhisk and Google Cloud Functions. Having each one of them it’s own particularities that won’t be covered in this post.

This brings to a new meaning for the word Function in the cloud computing world: a section of a program that performs a specific task. So Function as a Service is a synonymous used for the definition of Serverless and you will see them interchangeably in many technical docs or publications.

In summary…

Serverless computing is based on three main aspects:

  • Abstraction of the server layer. Server infrastructure is fully managed, thus developers don’t have to reserve any server instances. The code runs on different compute instances which is completely transparent for the code.
  • Timer/event driven scale. Serverless model is ideal to workloads that are based on events or time. The platform automatically can schedule your code and scale the number of compute instances it needs.
  • Pay only by what you executed. Serverless allows you to pay only when your code is executed. If there are no active function executions, you are not charged.

On the next post we will talk about the changes on the architecture that this new Serverless model brings to an application and we’ll see what kind of applications can benefit of it.

As always here are some good links from where I documented myself to write about this subject:

A special mention to Iris Classon and her blog, from where I took the inspiration of the “Stupid question of the day” format for these posts.

*Diagram credit to Sasha Rosenbaum in her book Serverless computing in Azure with .NET.

Happy Coding!