Based in London, united kingdom. working as a software engineer for palantir technologies. thoughts and ideas expressed are my own.

Serverless & Function-as-a-Service – A Brief History of Time

Serverless & Function-as-a-Service – A Brief History of Time

My least favorite part of serverless is having to have "but there's a server somewhere" discussion every single time it gets brought up. My response is: Serverless means you just have to think about servers, less.

There’s no servers to manage or provision at all. This includes nothing that would be bare metal, nothing that’s virtual, nothing that’s a container — anything that involves you managing a host, patching a host, or dealing with anything on an operating system level, is not something you should have to do in the serverless world.
— Chris Munns at re:Invent 2017

You just have to think about servers, less.

Call it serverless, Function-as-a-Service or cloud functions, the serverless architecture is capturing a lot of momentum. It took me a while to grasp the power of serverless architecture. It was a little over two years when I came across this article on the subject. After diving into it on and off for the past eighteen months, I’m convinced that this architecture solves a lot of different problems.

A brief history of time

A long time ago, folks decided that it would be cool to share information. Early on, this was utilized to connect machines via a network by universities, this started almost fifty years ago as ARPANET. In 1989 Tim Berners-Lee released a public proposal which later became the “world wide web”. A few years later, the information super highway was born. If you did not know this, or have forgotten, this is what news outlets used to call the Internet.

I still remember when most people did not have a  clue  about what it was

I still remember when most people did not have a clue about what it was

Browsers started becoming available that could render content that was being served by a computer somewhere else. It was really cool, because all of the sudden, anyone could serve content using from their own homes. Of course this came with a some limitations:

  • speeds were slow

  • when your sibling’s friends call, your server would go offline causing an complete outage for your service

  • IP addresses would change all the time

Still home computers were great for pet projects. But what about companies? Well they started hosting servers in their offices or garages. The challenge to make that information available at all times from anywhere in the world was on.

Bare-metal

This created an opportunity for companies to start offering what was called colocation services. Their mission was simple:

  • Provide power

  • Provide space

  • Provide a network

If you were lucky enough to have a bunch of capital kicking around and a network somewhere nearby, this was a no brainer. Of course, quite a few companies built data centers for their own needs with dedicated hardware.

Deploying applications on bare-metal requires a lot of work:

Bare_Metal.png
  • First thing is to find space, internal to your company or in a colocation facility

  • Buy and ship the hardware, then rack it either yourself or via professional services.

  • Install and configure the operating system.

  • Install the network tools for remote management and make sure these never fail. Otherwise it’s a roundtrip to the colocation centre. Now tools like IPMI allow access to the hosts even without a network, but it wasn’t always this easy.

  • Install the software and configuration needed for serving the application.

  • Finally it’s time to install the application code.

This created the need for organizations to dedicate entire teams to the process of running the operations of those servers.

Virtual machines

A few years later, companies that started out small and grew significantly, found the need to deploy and manage hundreds and eventually thousands of servers. Companies that started out as a small online bookstore or a search tool, needed to scale significantly to keep up with the demands of their users. Folks started thinking about running multiple environments on a single host in order to:

  • improve utilization of the hardware

  • simplify the deployment and management of the servers

  • ensure the security posture of one environment wouldn’t impact another

This provided new opportunities for service providers to offer a compute platform to their users. Datacenter providers started supporting Virtual Machines (VM). No more shipping hardware around to bring up a down nodes, simply request a new instance and you’re off to the races.

Deploying applications on virtual machines becomes a little bit better:

VMs.png
  • Still have to install and configure the operating system, but in a VM. Nowadays most providers support shipping a pre-built image via a variety of tools.

  • Install the software and configure needed to serve the application

  • Time to install the application code

So, it is a bit simpler, but this still requires a lot of configuration and setup before being able to deploy the application code.

Containers

Fast forward a few more years. The Internet is part of everyday life, even produce have their own websites to tell you how amazing they taste. The Internet just absolutely everywhere. Many different avenues were investigated for ways to simplify the management of applications at scale. Virtual environments, virtual hosts within VMs, freebsd jails, solaris containers/zones to name a few. Sometime in 2008, Linux Containers made their appearance as LXC containers.

A few years later, Docker made its splash. Many still argue about the merits of what Docker did for containers. Whether they just got all the glory of containers because of their cute mascots. Or whether it was because of the tooling they provided to simplify the packaging and deployment of containers. Or whether they just invested a lot of work to build a solid open source community. Either ways, before Docker, containers just hadn’t taken off.

Another opportunity arises here for infrastructure providers. They can now provide a platform that allows users to deploy containers, once again lowering the barrier of entry.

Deploying in containers looks like this:

containers.png
  • Create a container that will include an immutable runtime environment for your application as well the application code. In Docker, this is done via a Dockerfile. If you haven’t seen one, it’s a small amount of metadata that defines the contents of a container

  • Build the container and deploy it via a container orchestrator or a Platform-as-a-Service. Any number of Platform-as-a-Service provider will allow you to deploy your application in minutes

Containers proved it was possible to reduce the scope of what developers needed to worry about when deploying applications. They provided a simpler interface to shipping code directly into production. They also made it possible for platform providers to get creative. Platforms could improve the scalability of users’ applications. But what if developers could focus on even less?

Serverless

With serverless, it’s finally possible for application developers to really focus on the application code itself. In essence, a developer only needs to write an event handler in a single file of code to take advantage of serverless.

Example using AWS Lambda

Example using AWS Lambda

This code is then deployed by the platform provider into a runtime environment that supports the specific language. Providers already support a variety of languages.

Deploying to serverless is as simple as writing application code:

serverless.png

Serverless means…

  • Less code: It’s possible to ship the entire code in a single file. As long as you’re developing in a runtime that’s supported, you’re good to go.

  • Less servers: Application developers no longer have to think about where their code is running. This reduces the amount of configuration that needs to be managed outside of the application itself.

  • Less time to ship: serverless offers the possibility to deploy code in seconds. It reduces the investment of time required to test theories and deliver value.

  • Less expensive: The cost of serverless is calculated per function invocation. You only pay for what you use. This also means that you no longer need to run all those processes when your application isn’t in use.

  • Less time to react: Scaling functions is much simpler for both application developers and platform providers. Functions respond to events, the more events, the more functions can be launched.

More challenges…

  • More orchestration: the complexity of the overall system doesn’t go away because we’re using serverless. Instead of a single complex application, we now have many simple functions in a complex distributed system.

  • More latency: because applications are formed of tens or hundreds of micro services, the latency between each one has to be accounted for. Expect the network to fail.

  • More integration testing: testing the entire system becomes more complex. In many cases, it’s nearly impossible to replicate a full system in a development environment.

  • More observability: understanding the overall health of a distributed system is a complex problem. This isn’t a problem that’s specific to serverless architecture, but it’s definitely exacerbated by it. Configuring monitors, metrics, tracing and event logging becomes a necessity in order to identify problems in production.

Function-as-a-Service (FaaS) Providers)

There are many ways to get started with serverless code. The easiest way to get started is to sign up with one of the cloud providers. Whether you’re familiar with node, golang or python, most languages are already supported. Last week, Amazon announced the ability for users to bring their own runtime which increases the flexibility of serverless yet again. Here are just a few of the providers with links to getting started for each:

providers.png

This will save you some time setting up an environment. Each provider has a wealth of information on getting started if you just search for it. Most cloud providers have a “f*cking around”, “no idea what I’m doing” or “free” tier to allow users to get started at no cost.

Go Deeper

If you’re looking dive a little deeper in the stack, there’s a number of open source projects that will let you set up your own environment:

serverless_oss.png

Tradeoffs

In the end there’s always tradeoffs for any technology choice. Serverless is no different. Serverless is just another tool. Application developers have to ask themselves whether or not it makes sense for their use-case. I definitely think it solves many cases.

The Boundary Conditions — Should you even care?

The Boundary Conditions — Should you even care?

The top 1%

The top 1%