The word serverless does not mean applications can run without a server. Every application requires CPU, Memory to run the program which is a process in execution. However, Serverless enables applications to share the resource’s availability in an optimal manner. Serverless imply applications that are written in a stateless container, ephemeral and managed by a third party. The Serverless was first started by the AWS in 2014 by the launch of AWS Lambda. There are three aspects to the serverless namely application/services. Infrastructure and architecture. Let us look at all the aspects of the serverless.
There are three fundamental reasons to go serverless as listed below.
1. Lower Operational Cost: This means fewer servers, fewer people to manage servers and there is a division of labour.
2. Faster time to Value: Usually applications or services require servers to be provisioned. With serverless, there are zero applications to be provisioned.
3. Focus on core value: Serverless means outsourcing our architecture and focusing on the core value.
Perspectives of Serverless:
1. Application/services perspective: Serverless is lightweight event-based microservices like Google functions. Google cloud functions are light weight event-based response functions that allow a small single-purpose function that allows a lightweight response without needing a server to be managed at any given point in time. Effectively any lightweight function that is not dependent on a server can be run on a serverless architecture.
2. Infrastructure for Serverless: The infrastructure for serverless is totally managed by the vendor. Like AWS lambda enables the serverless infrastructure. Scaling is done automatically, and it is triggered by events.
3. Architecture: The architecture is usually stateless function; event-driven and uses API gateway to as an input to get triggered. An example of a stateless function in a website is the addition of an item to a cart.
Serverless offerings are being done both by the public cloud service providers and private cloud service providers. AWS offers Lambda service for serverless mode. AWS lambda is very popular, and the shift has happened to AWS cloud lambda based on the fit for purpose. Not every service can run on serverless but whatever is doing only focused on a single purpose and uses independently the Compute power then serverless becomes an option to be used. Like AWS, Microsoft Azure offers serverless compute as well. Google cloud provides cloud serverless to deploy and develop APIs in the form of Microservices. Serverless provides a new way of running an application as a FaaS. (Function as a Service).
Disadvantages of Serverless
1. Cold Starts: Sometimes cold starts take quite a lot of time say anywhere from 200ms-600ms.
2. Parallel Requests: Parallel requests are not allowed inside the code. Parallelism is an issue.
3. Coding Language: Need the language to support application development. Node.js supports the Serverless architecture and not python. It is best suited for background jobs, API calls, batch jobs etc.
4. Hidden costs: The right job must use the serverless as some of the cloud service providers charge based on the no of requests/usage of API gateway though the cost of the CPU. So, RAM will be less as the cost is being shared.
5. Code Maintenance: This is higher on serverless architecture.
The transformation to Serverless is worth doing considering the fact it leads to the huge cost savings available due to shared CPU and RAM cost. At the same time, the right application must be chosen to run the serverless.