Serverless refers to the practice of running a business IT infrastructure using third parties rather than investing in your own on-site IT infrastructure. The benefits of this include zero server management, no upfront provisioning, auto-scaling to meet traffic demands, and cost-effectiveness. But what exactly is serverless computing?
Before cloud computing, the process of developing applications used to require significant upfront capital investment in hardware and software before any code was even generated.
Cloud-hosted services improved the situation because the required resources could be run on a single server in the cloud – but the hardware to run those applications still needs to be provisioned, configured and paid for to execute the application.
That all changed when cloud vendors, Amazon, Google, Microsoft and IBM successfully began offering serverless computing solutions that were able to provide all the hardware and software resources needed to develop applications.
Serverless computing allows developers to write and deploy code without having to manage the underlying infrastructure. While servers are still required to run the apps, the architecture is designed so that the developer doesn’t need to worry about server management, or to make capacity planning decisions.
As a result, serverless computing has become the leading infrastructure in the software architectural world and taken on new importance for businesses looking to scale in the future.
Scaling
The point about scaling is particularly important, as the on-demand, auto-scaling nature of serverless cloud computing means computational resources scale automatically based on the load. So, whereas one or two VMs can cope with a load-rate of 10 – 100 requests per second, for example, it becomes more challenging if this number rises to thousands of requests per second – requiring additional technologies to scale to high load mode (such as autoscaling groups in AWS, EC2 instances templates, stateless apps etc.).
Types of Serverless Computing – BaaS vs FaaS
The idea of serverless encompasses two overlapping areas – applications that incorporate third-party cloud-hosted applications and services to manage server-side logic, and applications where server-side logic is written by the application developer but fully managed by a third party. These two types of serverless infrastructure are most commonly referred to as Backend-as-a-service (BaaS) and frontend-as-a-service (FaaS), respectively.
BaaS manages every part of the code, so is in effect a complete online service. Typically, the code runs continuously after being triggered on a shared infrastructure together with other applications using the same backend service. Examples of vendors offering BaaS infrastructure are Parse, Kinvey, Appcelerator, Firebase and StackMob.
FaaS only provides the tools to execute code designed by the developer. A typical serverless application will consist of several functions – which is why serverless platform providers refer to it as FaaS. Each function is a component of the application, linked together at the back end by the provider’s platform, or by third-party networks.
FaaS works by triggering code on demand when a certain event happens – in other words, serverless code is usually event-driven. So, it runs when triggered, and once it has completed its task it spins down, waiting for the next request. The provider manages all the mechanics of the process and charges the customer based on the business functionality being delivered, not the hardware. In other words, this is pay-as-you-go code execution.
Because serverless code execution is fully managed by the cloud provider, it does away with the traditional method of developing applications and deploying them on servers. As a result, developers can focus on creating code that behaves in a specific way in response to a given input and runs independently of the rest of the application.
This makes it very cost-effective, as you pay only for the time taken to execute code – i.e. what is invoked at that trigger, in fractions of a second, measuring memory and CPU usage – not for any idle time. And because of this, charges can be highly granular. The cost savings include businesses no longer having to worry about managing, provisioning and maintaining the servers when deploying code.
Another benefit of FaaS is that users don’t have to wait for HTTP requests or API calls because the code is only executed when the need arises.
Serverless Examples
One of the most popular FaaS offerings is AWS Lambda from Amazon Web Services (AWS), which allows developers to run code without provisioning or managing servers. AWS charges for the compute power you use according to 100 millisecond increments. As a result, developers can focus on their code and event triggers and AWS does the rest.
Blueberry has used AWS Lambda many times for building serverless applications for clients wanting systems that scale perfectly and cheaply.
Other AWS serverless options include AWS Fargate, Amazon Aurora Serverless and Amazon DynamoDB. AWS Lambda, however, remains one of the most popular implementations.
Besides AWS, additional serverless vendors include IBM’s OpenWhisk, an alternative event-based architecture, Microsoft has Azure Functions, and Google’s Cloud Functions.
When it comes to cost, serverless offers a lower cost of ownership (TCO) than virtual machines (VMs) and containers for most new applications, even though the serverless pricing model is essentially the same as existing VMs. This is because serverless infrastructure can be easier to maintain, so reducing developer time as there is no need to provision, configure and manage infrastructure, particularly in response to changing market conditions – just tweak the code as required. Once the task has been carried out, the container is taken out of service, so eliminating any ongoing cost of a dormant container.
Looking to the future, it seems that the trajectory of serverless computing is set to continue as large businesses embrace the new technology, driven by the numerous advantages outlined above: customers only have to build the business logic; there are cost savings due to improved utilisation; the granular nature of pricing; and finally the competitive offerings between providers, which can only drive prices down.
AWS Lambda is a popular AWS service which can be used to build and run serverless applications. It is also a service that Blueberry has strong expertise in – having used AWS Lambda for building serverless applications for numerous clients. Get in touch if you’d like to discuss the potential of Serverless Computing for your business.