One of the latest moves by cloud service providers (like Microsoft Azure and Amazon AWS) is the shift to offering “serverless” services. These are Platform as a Service (PaaS) services that take the “fully managed” aspects of the service to the max. Serverless service offerings (such as Microsoft Azure Functions) allow for individual code functions to be deployed and managed without the need to deploy and manage the underlying Virtual Machine (VM), including even the applications that hosts the functions too! Additionally, the billing of Serverless architecture only charges you when your code is running, instead of paying to keep the underlying server resources reserved and available. This article will dig into Serverless Architecture, and help clear up many of the common questions surrounding this “Platform as a Service to the MAX” technology.
Serverless architecture isn’t really to host applications without servers. Of course there still needs to be CPU, RAM, Networking and other components of a computer server in order to host any software. Rather, Serverless really is about taking Platform as a Service (PaaS) to the max!
Serverless is about taking PaaS and turning it up to 11!
Modularity & Flexibility
Platform as a Service (PaaS) abstracts away the underlying hardware and infrastructure so that application code can more easily be hosted, deployed, and managed with much less overhead than traditional hosting. Serverless architecture takes PaaS to the most extreme, by fully abstracting away the server in such a way that a single function of code can be hosted, deployed, run, and managed without even having to maintain a full application.
Each function of code for a back-end systems Web API or Background Processes can be managed individually with Serverless architecture. This helps make systems much more modular, as well as increasing the overall system flexibility. This enabled modularity is ideal for Micro-Services based systems as well.
With the modularity of hosting individual Functions of code comes with it added flexibility. Not flexibility in the Function, but rather flexibility in writing, maintaining, and deploying code. Each Function can be maintained, updated, and deployed individually. This mean that each Function can be updated and deployed in isolation without the risk of taking down other Functions in order to do so.
Functions in Serverless architecture can almost be thought of as “mini-programs” that are maintained by themselves.
Just as a Function of code within an application, in Serverless architecture there needs to be something to trigger the code to run and subsequently return a result. The entry points to execute Functions of code hosted in a Serverless architecture are built around events. This Event Driven (or Event-based) design of Serverless architecture is ideal since Functions of code are hosted as individual items.
Functions of code hosted in Serverless architecture are bound to specific events that fire them off and execute them when necessary. Here’s a few examples of events that can be used to trigger the execution of Functions of code in Serverless architecture:
- HTTP / HTTPS Request
- Message Queue Trigger
- File / Storage Trigger
- Timer / Schedule
An HTTP / HTTPS Request trigger can be used to expose a Function of code as a Web Service / API of some kind. For example, it could be used to expose a REST API endpoint that performs an action and returns a JSON response. This type of usage would allow for a Serverless implementation of a Web API without the need to build a larger application / infrastructure to host it.
Functions of code hosted in Serverless architecture are bound to specific events that fire them off and execute them when necessary.
The possibilities of pricing Serverless architecture differently is possible due to it being based around an Event Driven model. Other more traditional Platform as a Service (PaaS) allow for reductions in hosting and ownership costs by abstracting away many manual tasks necessary for general server maintenance and deployment. In a way traditional PaaS is “serverless”, but not completely.
Full Serverless architecture hosting services allow for an even greater abstraction of the underlying hardware, Virtual Machine (VM), and infrastructure than traditional PaaS offerings. Since these things are abstracted away as much as possible with Serverless architecture, it enables the Functions of code to be hosted in a way that can better utilize the underlying CPU/RAM hardware with multi-tenancy. Due to this, the cost of Serverless services provide even greater cost savings over traditional PaaS services.
Multiple clients Functions of code can be hosted on the same hardware and/or Virtual Machine (VM) with the ability to host Serverless architecture services in a multi-tenant manner. This allows Cloud Service Providers, like Microsoft Azure, to even further utilize their CPU/RAM and other server hardware to their capacity. This is done by pooling Functions of code / applications from multiple clients (tenants) on the same hardware.
Since Serverless architecture is best hosted in a multi-tenant manner (as described above) the majority of service providers bill Serverless services out on a “Pay-per-Use” basis. Without a full VM, CPU/RAM allocation being billed and paid for to be reserved / available, it doesn’t make sense to bill clients for a full VM instance. Instead, Serverless cloud services (like Azure Functions) are billed by keeping track of the total CPU and other resources used solely during Function code Execution.
Pay-per-Use serverless architecture billing is simplified that charges are only incurred if and when the Functions code is actually executing. When an event triggers the Function to execute, the resources consumed by the Function of code are tracked and billed. When the Function of code is NOT executing, then no costs are incurred.
The billing of Serverless architecture only charges you when your code is running, instead of paying to keep the underlying server resources reserved and available.
With the multi-tenant nature of Serverless architecture, it’s possible for the underlying platform to host and run each Function of code for a particular client on completely disparate hardware and Virtual Machines (VMs) completely unbeknownsed to the client. This method of hosting makes if ideal for automatic scalability.
Serverless architecture services are able to utilize their “Platform as a Service (PaaS) to the MAX” nature to better optimize scalability than traditional PaaS services. In addition to potentially hosting each Function of code on different underlying servers, there could also be multiple instances of each Function of code hosted across multiple underlying servers as well. This allows a Serverless platform (like Azure Functions) to automatically scale out to the maximum degree.
Serverless architecture services are able to utilize their “Platform as a Service (PaaS) to the MAX” nature to better optimize scalability than traditional PaaS services.
Serverless in Microsoft Azure
The service offering in the Microsoft Azure cloud platform is the Azure Functions service. Azure Functions allow for Serverless architecture to be built out on the Microsoft Azure platform. It also supports many different platforms and frameworks, like .NET, Java, Python, and Node.js. Azure Functions are extremely flexible where Functions can easily be authored in .NET or Node.js directly within a web browser. Azure Functions can even be built as a console applications or entirely as shell scripts.
The next wave of Platform as a Service (PaaS) is here, and it’s Serverless Architecture!