Serverless computing is a misnomer. Computing is impossible without the presence of a machine. Just like a virus needs a host, code can also not run in thin air, it needs machine resources to take input, process, and then produce output. So then what is serverless computing, and why is it gaining so much popularity? Basically serverless computing is a relatively new variant of existing cloud computing model PaaS (Platform as a Service), where machine (server) resources are made available on demand by the cloud provider right at the time of code execution. Such a model frees up the client from provisioning, scaling, and maintaining server(s), even if it is on the cloud, and focus exclusively on application code. The cloud provider takes on full responsibility of making the server resources available just in time, and client pays for the bursts of usage and for the storage where the resulting output data may reside.
In this edition, we discuss two (2) serverless architectures at a high-level from cloud providers Amazon and Microsoft:
|1) Amazon Web Services: AWS serverless architecture rests on two (2) key offerings by Amazon: 1) Amazon API Gateway and 2) AWS Lambda. Although there are other offerings such as Amazon RDS, DynamoDB, Amazon S3, that invariably become integral part of a complete solution, it is these two that any AWS based serverless computing solution cannot be developed without.|
AWS Lambda: AWS Lambda is an environment that supports code (business logic) written in one of many languages as part of web service that are triggered in response to an event. These are basically functions (micro-services), also called handlers, which are triggered by events, which in turn are triggered by an API call from a client that flows through the Amazon API Gateway. AWS Lambda provisions computing resources and scales them according to the usage of these Lambda functions.
Other AWS Offerings: As previously mentioned, other AWS offerings may be integrated with these two to make a complete standalone solution depending on the needs and requirements. For example, AWS Lambda and the data tier (RDS, S3, DynamoDB, etc.) can be deployed in an Amazon VPC (Virtual Private Cloud) or integrate IAM (Identity Access Management) to make the application and data more secure.
|2) Microsoft Azure: Azure Functions is a cloud service, similar to AWS Lambda, offered by Microsoft, that offers machine resources on demand to process requests without having a server deployed on permanent basis. Azure Functions extends existing Azure application platform with capabilities to implement code triggered by events in Azure, or 3rd party services. it provides an intuitive, browser-based user interface allowing one to create scheduled or triggered pieces of code implemented in a variety of programming languages. A wide range or triggers and connectors allows for the code to react to events in Azure services. Just like AWS, Azure offers data services (Azure Storage, Azure SQL DB, etc.) for functions to persist data on these servers. Data passed from one function to another or from a data source to a function rely on bindings which make it transparent to the developer who then just needs to focus on its usage rather than worrying about how it is flowing from one system to another. A set of pre-configured operating system image, that don’t require patching, obviate the need for any server maintenance in addition to separating OS layer from the code.|
Comparison Between the Two: While this is a topic that requires an email on its own just for a high-level coverage, we will just touch upon a few important differences. AWS serverless model is very tightly integrated with the programming model making the code developed and deployed uniquely targeted towards the AWS serverless paradigm. On the other hand, Microsoft’s approach allows for more flexibility in that code developed for Azure Functions can also be deployed and executed in the hosting models offered by Microsoft. Lambda provides a wider choice in maximum memory allocation (128MB – 3GB), whereas Azure functions comes standard with a 1.5GB memory, unless of course one opts for the premium plan, which is more expensive. They both support a variety of programming languages. Lambda reserves separate instance for each execution which makes performance predictable and stable, but not necessarily efficient. Azure on the other hand, spawns off multiple concurrent executions sharing the same resources like memory and CPU cycles, which makes it efficient for normal executions, but may slow down the performance during high-resource usage. On the face of it, unit pricing of both offerings seem to be comparable, but the devil is always in the detail. Only a detailed analysis for a specific computing scenario can reveal which offering is more cost-effective in the long run.