With the massive adoption of cloud technologies like Infrastructure as a Service — IaaS, Platform as a Service — PaaS, and Software as a Service — SaaS, by organizations and developers, cloud providers are re-inventing the wheels on how modern applications can be developed, deployed and served to end-users by developers. One of these re-inventions in the provision of cloud services by the providers is serverless computing (or architecture).
Organizations and developers taking advantages of the cloud in the delivery of their apps and services are usually meant to pay for a fixed unit of computing resource — like networks, servers, and storage — delivered over the cloud. There is the advantage of scaling up or spinning down according to the demands of the apps, and also the consumption of a pool of large computing power.
For the traditional cloud service, developers and organizations may have to handle some responsibilities like setting up servers and the tooling for the delivery of their apps.
But serverless computing is changing the way that modern app is built and delivered. Well, make no mistake about it, serverless computing doesn’t imply the absence of servers. If it doesn’t imply the absence of servers, what then is serverless computing?
What is Serverless Computing (Architecture)?
Serverless computing in the most basic terms is the development and deployment of applications without bothering about servers. Serverless computing takes advantage of the cloud, in providing the infrastructure — servers and the tooling — needed to build and deploy modern applications by developers.
At its core, serverless computing makes it possible for developers to write and deploy codes without worrying about the underlying infrastructure. It is auto-scaling, meaning that clients are charged based on computation — the time the code runs (pay as you use basis) — and not on a fixed amount of cloud usage. What’s more? It hinges on the concept of abstraction since developers do not know about the infrastructure on which the server is running.
The major advantage of serverless computing is that developers can focus on their core responsibility — building modern apps instead of bothering about managing and operating servers or run time — whether in the cloud or on-premises.
How does serverless work? A brief overview of FaaS
To understand how serverless computing works, we will have to take a look at a cloud computing service model — Function as a Service, FaaS.
Here is what Wikipedia defines FaaS as
Function as a Service is a category of cloud computing services that provides a platform allowing developers to develop, run, and manage applications functionalities without the complexity of building and maintaining the infrastructure typically associated with developing and launching an app.
So cloud service providers like AWS, provide a mechanism or toolings like AWS Lambda for developers to build modern apps, running code without provisioning or managing servers. With this, developers can run code for any type of application or back-end service, with no server administration.
The code written by developers is executed on a serverless architecture like calling a function which response to an event. An example of this event is a user uploading an image, which triggers a function call. Once the execution of the function is completed, the cloud service then spins down the underlying infrastructure. This plays a significant role in user billing, as charges are only made when the code runs.
This means that serverless architecture works through Function as a Service — FaaS, liken to the execution of a function in a microservice architecture, where applications are broken into modules, which can run independently and communicate through API calls.
This implies that serverless consume functions — developers write code as snippets of functions or modules, which are then executed when the function is called.
A Look at Some Serverless Architecture Providers
- AWS Lambda — AWS Lambda lets you run code without provisioning or managing servers. Users only pay for compute time.
- Microsoft Azure Function— Azure function is an event-driven serverless compute platform.
- Google Cloud Functions—An event-driven serverless compute platform from the Google Cloud Platform. It is a lightweight compute solution for developers to create single-purpose, stand-alone functions that respond to cloud events without the need to manage a server or runtime environment. Learn more about GCF here.
- IBM Cloud Functions — A FaaS programming platform for developing lightweight code that scales on-demand.
Pros of Serverless Computing
- Cost-effective — developers and users only pay for the time that code runs on a serverless compute platform. You don’t have to pay for idle virtual machines.
- Autoscaling — the delivery of services via a serverless architecture means that scaling is handled by the cloud provider for you. You only pay for the compute time, and should there be an increase in demand for the service, the provider handles the scaling up or spinning down when the code isn’t running.
- Increase in developers productivity, as time will be spent on the core task of writing and developing apps, instead of tinkering with servers and runtimes.
- With serverless, developers do not have to specify or configure virtual machines on the cloud.
Cons of Serverless Computing
- Vendor lock-in — There is a high possibility of differences in the delivery of serverless services from one vendor to another. Making it difficult to make a switch in cloud providers.
- Security concerns
- At the moment, there seems to be limited support for a range of programming languages and technologies.
- Latency — delay in the time it takes to run a serverless function for the first-time, often known as a cold start.
- Difficulty in debugging and running test, as developers are shielded from the core server infrastructure and tooling.
Make no mistake about it, serverless computing doesn’t imply the absence of servers. It is, however, the provision of cloud server infrastructure to enable developers to write back-end codes and have these codes run like a function — utilizing Function as a Service, FaaS — on a cloud provided server.
Developers can thus, focus solely on their core responsibility of writing codes and only pay for the time that the code runs on a serverless architecture. This means that developers should be concerned about the delivery of the service and not the delivery mechanism or tooling.