
Serverless Computing
What is it?
Is it actually worthfull?
What exactly does serverless computing actually mean.
In this article I will be explaining serverless computing and we will see if Serverless computing is actually server-less.
Serverless computing (or serverless for short), is an execution model where the cloud provider (AWS, Azure, or Google Cloud) is responsible for executing a piece of code by dynamically allocating the resources. And only charging for the amount of resources used to run the code. The code is typically run inside stateless containers that can be triggered by a variety of events including http requests, database events, queuing services, monitoring alerts, file uploads, scheduled events (cron jobs), etc. The code that is sent to the cloud provider for execution is usually in the form of a function. Hence serverless is sometimes referred to as “Functions as a Service” or “FaaS”. Following are the FaaS offerings of the major cloud providers:
AWS: AWS Lambda
Microsoft Azure: Azure Functions
Google Cloud: Cloud Function
Traditionally, we build and deploy web applications where we have some degree of control over the HTTP requests that are made to our server. Our application runs on that server and we are responsible for provisioning and managing the resources for it. For smaller companies and individual developers this can be a lot to handle. Serverless abstracts the underlying infrastructure of the servers away from the developer.
Is Serverless actually server-less ?
While serverless abstracts the underlying infrastructure away from you, servers are still involved in executing our functions. So serverless is not actually server-less since servers are still going to be used to execute our functions. As I said earlier what serverless does is that it abstracts the infrastructure away from you so you don’t have to worry about it.
Some Common Terms in Serverless Computing
Microservices
Stateless Functions
Cold Start
Microservices
Microservices — also known as the microservice architecture — is an architectural style that structures an application as a collection of services that are
Highly maintainable and testable
Loosely coupled
Independently deployable
Organized around business capabilities.
The biggest challenge faced when trying to move into the serverless world is that your application needs to be architectured in the form of functions. You might be used to running your application as a single monolithic app but with serverless you are typically required to adopt a more microservice based architecture. You can get around this by running your entire application inside a single function as a monolith and handling the routing yourself. But this isn’t recommended since it is better to reduce the size of your functions.
Stateless Functions
Your functions are typically run inside secure (almost) stateless containers. This means that you won’t be able to run code in your application server that executes long after an event has completed or uses a prior execution context to serve a request. You have to effectively assume that your function is invoked anew every single time.
A stateless function is predictable, you can trust that given a certain input it will always produce the same output.
Cold Start
Since your functions are run inside a container that is brought up on demand to respond to an event, there is some latency associated with it. This is referred to as a Cold Start. Your container might be kept around for a little while after your function has completed execution. If another event is triggered during this time it responds far more quickly and this is typically known as a Warm Start.
