A Serverless path to abstraction Nirvana
Earlier in the year I wrote an in-depth introduction to Serverless Architectures — defining what they are, weighing pros and cons, etc. One idea that's been on my mind recently is how Serverless solutions have come about via the evolution of other infrastructural advances over the last few years, and where differences are with Serverless vs. other approaches.
In this note I'm going to talk about one of these difference areas — that of the abstraction of the host that Serverless provides.
One argument that Serverless isn't anything new is that it is just another form of PaaS (Platform-as-a-Service) or container platform . I talk about this in a few ways in the article but one thing I want to drill into a little further is the abstraction that Serverless gives over its host environment.
We've been increasing the layers of abstraction of server host environments for years now. It started when we placed our own physical servers in hosted data centers rather than in our own offices. At this point the connection to the server-site's ISP (internet service provider) was abstracted. Continuing, we stopped having to worry about physical servers (through virtualization) and Operating Systems (through PaaS or Containerization.)
Serverless tends more towards the ultimate destination of this path — complete host abstraction for our application logic.
PaaS and Containers get close — with the former you typically don't worry about an Operating System (OS) when deploying a component — just a programmatic environment. With the latter you still think about a form of OS in the definition of a container, but due to the nature of a container it's much reduced in management need to the point of not really being an OS at all.
Serverless solutions go even further down this path. Neither with Serverless BaaS (Backend-as-a-Service) nor FaaS (Functions-as-a-Service) do you worry about any OS, but there's a more important point — you have no concern with resource allocation or capacity planning.
What do I mean by this, and why do I think there's a difference here?
Take containers as an example. When you deploy a Docker container to Amazon ECS you still need to think about the hosting Cluster that your container will run on. You need to consider such questions as:
- Which Cluster would be best placed to run this container?
- Does the Cluster have capacity for my container's resource needs (CPU, memory)? If not how should I expand it?
- What is my strategy for deploying multiple instances of the container across multiple machines in the Cluster?
- If the Cluster has multiple types of machine within it, do I need to be concerned about that when I choose my deployment strategy?
- What are the security constraints of the Cluster, and do they need to be changed in order to properly host my container?
Even if you use an environment like Mesosphere which tries to help with some of this someone in your organization is still thinking about these resource and capacity questions, and typically each application team is still going to be considering them to some extent.
With Serverless you have no such questions — the hosting provider figures out all the allocation questions for you dynamically, and guarantees it will have sufficient capacity for your needs (typically up to a limit across a coarse-grained context, like an account.) This is a big deal. Not only does it remove the need for people in an organization to be worried (and spending their time) on such concerns, it also means you're not spending too much money upfront over-provisioning your host environment, nor are you constrained down the road by under-provisioning your environment.
Until 3rd-party hosting container environments remove the need for resource and capacity questions it's a clear benefit of Serverless. That's not to say that hosting environments won't ever get there, and some PaaS environments already give you some of this.
So have we reached our host-abstraction Nirvana with Serverless? For Serverless BaaS I think in many cases we have! For Serverless FaaS? Nearly, but not quite! I still think we need to gain trust in FaaS host environments (right now I can monitor certain aspects of the host container and I should never have to do this.) There's also a question in my mind about coarse-grained location / networking. For instance it would be great never to even have to worry about what region my AWS Lambda function runs in, no matter my VPC need, knowing that AWS would just 'do the right thing'.