What is Serverless?

at in articles

TL;DR

Encapsulate your code in functions and let a cloud provider run it for you. No provisioning or managing servers required.

Summary

Introduction

Let’s start by the name itself, it wrongly suggests that there are no more servers involved, which is definitely not true. There are a lot of servers in the “Serverless” world, but you don’t need to worry about them anymore.

A third-party cloud provider is responsible for executing your piece of code on an ephemeral environment, charging only the dynamically allocated resources used to run it.

Because it abstracts the underlying infrastructure layer and provides the access to its features through a service, Serverless can be referred to as “Backend As A Service” or “BaaS”.

Main characteristics

  • Stateless: Given its dynamic quality, Serverless functions are inherently stateless.

  • Event Oriented: Serverless is event oriented by nature. The function can be triggered by a myriad of event sources like queue services, HTTP requests, alerting mechanisms, scheduled tasks, etc.

  • Continuous Scaling: It automatically runs in parallel, scaling continuously as the demand increases.

  • No Server Management: The infrastructure layer is out of sight.


Providers

There is a good amount of options in the market with different levels of maturity and runtime (environment with a specific language executer) options, but basically, all of them offers the same core features.

Here is a list of some of the main providers:

Amazon AWS Lambda

The market leader, has initially launched its Serverless platform supporting just a handful of runtimes, now officially supports Node JS, Go, Java, C#, Ruby, and since November 2018 it introduced a feature called Layers, that provides the ability to run virtually any language.

Google Cloud Serverless Computing

The giant is also in the Serverless game but offering a much smaller range of runtimes, NodeJS, and Python (in beta).

Microsoft Azure Functions

Microsoft offers middle ground in terms of runtime options. Production-ready is C#, NodeJS, F#, Java, and in experimental status are Python, Typescript, PHP, Batch, Bash, Powershell.

IBM Cloud Functions

IBM Cloud Functions is based on Apache Openwhisk an open source, distributed Serverless platform. Natively supports Node.js, Java, Python, serverside Swift, and PHP. But also allows you to use Docker containers, permitting virtually any language.


Pros & Cons

Pros

  • Initial development time: To get a project up and running that is reliable and scalable is incredibly fast, especially if you choose to integrate with existing products from the chosen vendor.

  • Operational overhead: A lot of the overhead is taken away from you with Serverless, but it does not mean that everything is done out of the box.

  • Scalability: It is made from the ground up to provide highly scalable infrastructure for your application.

Cons

  • Vendor lock-in: Since you rely on third parties to abstract all the underlying complexity, you end up increasing dependency. There are ways to minimize coupling but once functions get more complex, switching from one vendor to another may not be a trivial task.

  • Hard to predict costs: You pay as you grow, but it can be difficult to plan your costs, particularly if you are starting out without hard data to base your calculations on. In any case tools such this can help a lot!

  • Tooling: It is a fairly new paradigm, so at this stage mature tooling is still a problem to find.


Use cases

This kind of architecture is by no means suitable for every scenario, Serverless is definitely not ideal for long-running tasks, on the other hand, everything that is event-driven or is short lived can be a good match for Serverless, for example:

  • Chatbots
  • IoT
  • Integrating services
  • Microservices
  • Execute actions for static websites
  • Voice assistants
  • CI/CD pipelines

Case Studies

How We Bootstrapped Our Startup by Skipping Half the Work

Company: Moo.do
Provider: Google

Jay Meistrich co-founder and CEO of Moo.do explains how the choice of going Serverless helped him and his partner to launch their project by themselves.

Coca-Cola: Running Serverless Applications with Enterprise Requirements

Company: Coca-Cola
Provider: AWS

A nice presentation from Patrick Brandt about the Vending Pass program, the product is for rewards for buying in vending machines.

Travel technology startup goes to market three times faster with Microsoft Azure and Node.js

Company: Hotailors
Provider: Azure

The article shows how the company using Serverless reduced service integration times by 30 to 50 percent.


Conclusion

Serverless is not a magic solution that will solve each and every one of your infrastructure problems. That being said I need to point out that in my personal opinion it will be increasingly hard to find reasons to not use it.

It breaks a lot of the barriers that slows down changes, improvements and new projects, while still being able to offer a lot of flexibility to the developers.

This alternative differently from containers which feel like a natural step in the evolution, serverless is like a different direction that requires us to rethink a lot of the steps involved in building a modern application. It doesn’t just affect the way we handle the infrastructure but also how our code should be organized, accessed, tested…

Serverless is still fairly new but already has proven to be a valuable tool to have in your toolkit.