Conceptualizing serverless computing
Learning objectives
- You know the term serverless computing.
In Scaling with Kubernetes, both in scaling applications manually and in scaling applications automatically, scaling of applications has been done by adjusting the number of available pods. Each pod is a running container with a lightweight layer on top of the operating system. Adjusting the number of pods, when done automatically, can take tens of seconds, as the scaling is done based on the collected metrics. If done manually, the adjustment can take more time, as manual adjustment can include modifying the configuration files and applying the changes, not to mention the time that it takes to identify the need for scaling.
Serverless computing is a cloud-based, event-driven architecture that abstracts away infrastructure management, allowing developers to focus on writing code while automatically scaling resources and offering a pay-as-you-go pricing model.
This is where serverless computing comes as a solution. Serverless computing is a cloud computing execution model where the responsibility for the infrastructure and the configuration of the platform is given to the cloud provider. The pricing is based on the consumed resources instead of the reserved resources, and serverless applications run in containers that are launched on demand, do not have a state, and may even run only as long as to respond to a single request.
The term serverless is misleading. There are servers, but their maintenance is abstracted away.
The maintenance of the servers and the infrastructure is handled by the cloud computing provider, and the developer does not have control over e.g. specific virtual machines or the underlying operating system that is used to run the serverless applications. Similarly, the developer does not have control over the platform that is used to run the serverless applications as the platform is also abstracted away, and the provider can even change the platform without the developer noticing.
When considering serverless computing, there are plenty of upsides and a handful of downsides, which are in part in line with the upsides and downsides of cloud computing applications in general. Serverless computing provides opportunities for high scalability and availability, as containers are launched on demand, while also providing cost efficiency, as the costs incur only from used resources. Similarly, as there is no need to manage (or even configure, depending on the provider) the underlying infrastructure and platform, the development and deployment of serverless applications can be faster and easier.
On the other side, the lack of control over the underlying infrastructure and platform can be a challenge, and monitoring serverless applications can be challenging as containers come and go. Similarly, as the containers are launched on demand, there is no state, and the data needs to be hosted on a separate instance, which can be a challenge for applications that require state. Finally, as the containers are launched on demand, there is a cold start time, which depends on the application, and serverless computing providers also often limit the time and resources that each individual container have at their disposal.