Intended article audience: CTO’s, architects & developers
Keeping track of technology developments, trends and buzzwords, one term cannot be missed out: serverless computing or serverless architecture. It is a next step in the evolution of cloud computing (the delivery of computing services—servers, storage, databases, networking, software, analytics, and more—over the Internet).
Serverless computing takes away the necessity for you to think about the computing capacity required for your piece of software to run. And next to that let’s you execute and pay for it on-demand.
In my blog posts I am flying with you from a high-level and technology vendor independent view to the technical details on the Microsoft technology stack.
Summary of Cloud Service Models
Before we are going to look at what serverless computing actually means, we first go through a short recap of Cloud Service Model terminology. Probably well-known, but it makes positioning serverless computing within this space more convenient and makes it also more understandable for people with less knowledge on the topic. If you are well-known with cloud computing then you can skip this paragraph and jump to the next one.
IaaS lets the company focus on utilizing the infrastructure and consumption based payment instead of maintaining the infrastructure and doing investments on it.
The first model closest to on-premises IT is Infrastructure as a Service (IaaS). This model provides the basic building blocks for Cloud Computing. The dedicated or virtualized hardware (networking, storage and compute resources) is owned and hosted by the Cloud Service Provider and provided to a company in a virtual way. This company can self-provision the infrastructure on-demand and does not have to worry about maintaining the hardware itself. IaaS lets the company focus on utilizing the infrastructure and consumption based payment instead of maintaining the infrastructure and doing investments on it.
With PaaS companies can focus on the deployment and management of their applications. Management of underlying infrastructure is abstracted away.
The second service model, Platform as a Service (PaaS), provides the operating system, middleware and runtime on top of the infrastructure layer. With PaaS companies can focus on the deployment and management of their applications. Management of underlying infrastructure is abstracted away.
And last but not least, the Software as a Service (SaaS) model where also the application and data are managed by the provider. The software is licensed on a subscription basis and centrally hosted. A company can focus with SaaS on how to use the functionality provided by the application while not having to manage feature additions, servers or operating systems. Well known examples of these complete software products, available as SaaS services, are: Office365, Google Apps and SalesForce.
With FaaS a company can focus on the logic that a piece of software needs to provide and pay for it per execution.
Suprise: it doesn’t mean that there are no servers involved of course. The key of serverless computing is that you don’t have to think about the computing capacity required for your logic. For example answering questions like how much instances of your application are required or how many Virtual Machines you need. In this sense the “serverless execution model” can be positioned between PaaS and SaaS.
There is no single definition or view on what is meant with serverless. One way to look at it is the use of 3rd party backend services within your own solution. Let’s take an example by looking at identity provider functionality. Functionalities like authenticating a user based on credentials and resetting the users password etc. are provided by products like Azure Active Directory B2C or Auth0 . These services take care of scalability and let you pay per authentication. This appearance of serverless computing is referred to as Backend as a Service (BaaS).
The latest development of serverless is about breaking down an application or a microservice into discrete functions. These small bits of code that execute based on events enable efficient resource utilisation. The code of these functions is deployed and configured into a cloud environment and the cloud provider takes care of running these pieces of code triggered by events coming in. This is also referred to as Function as a Service (FaaS). With FaaS a company can focus on the logic that a piece of software needs to provide and pay for it per execution. The focus here is on the development and deployment of small pieces of source code.
In the remainder of this post I will focus on serverless in the context of FaaS.
It is event-driven, computes on-demand and scales automatically
Cloud providers have jumped in the FaaS space with their own offerings: AWS Lambda (Amazon), Azure Functions (Microsoft), Google Cloud Functions and IBM OpenWhisk.
Execution of code is triggered by an event. Types of events depend on the ones offered by the cloud provider. This can range from a file update on Amazon S3 or OneDrive, a timer event, a message on a queue or an incoming HTTP request.
With serverless computing the application code is taken, put into a container, executed and teared down without you knowing anything about this process and its underpinnings.
With serverless computing the application code is taken, put into a container, executed and teared down without you knowing anything about this process and its underpinnings. The cloud provider takes care of finding a server for the code to run on and scales up if necessary. The way this is physically implemented, like the container architecture, varies between the cloud providers.
Because of the unit of measure, which is a function that is executed, it is sometimes also referred to as the concept of a nanoservice. We are not going into a discussion now if this is valid or not or all that different from microservices. Let’s stick to the fact that it matches perfectly with the concept of microservices, mobile and IoT. It provides auto-scaling and load balancing out-of-the-box making it unnecessary for you to manually configure clusters, load balancers etc. The only thing you have to do is give the code to your cloud provider et voilà!
Efficiency in IT spend
FaaS or serverless computing can be much cheaper, because you pay-per-execution. You don’t pay for resources being idle. Next to that no money is lost on managing the infrastructure and platform to do scaling for example.
Focus on functionality and code
Letting you focus on the functionality to deliver, the application, maximizes the time you spend on delivering true added value. Non-value activities like managing the infrastructure are removed from the software development process.
This fulfils the goal of Lean software development: eliminating waste by removing the non-value added components from the software development process.
As mentioned earlier: FaaS matches perfectly with microservices, mobile and IoT which are the modern architectures of today. This is because of the event-driven nature of FaaS. The loose coupling of components and good distribution is a real strength allowing for architecture agility and and high scalability.
Revolutionary would be the possibility of moving to a post-virtual machine and container era. Imagine that you just upload your cross-platform application code, in your programming language of preference, to your favourite cloud provider. And your code will run without you absolutely not knowing anything about the application container*, execution environment and operating system it will be running on. It auto-scales out-of-the box and you pay per execution. That would be true serverless computing.
* It is too much for this article to dive into application containers in detail, but to put it short: application containers wrap a piece of software in a complete filesystem that contains everything needed to run this software: code, runtime, system tools, system libraries – anything that can be installed on a server. This guarantees that the software will always run the same, regardless of its environment. If you want to read more on this: my colleague Cornell Knulst has written a nice blog post about the concept of containers for further reading. The serverless execution model as stated in the paragraph above could basically abstract away these containers.