Serverless, the term which you come across whenever anyone talks about any public cloud platforms. It has gained a lot of popularity and attention in the industry. Many teams have witnessed the benefits of using serverless already and modernizing some of their workloads to serverless.
Serverless opens up the new possibilities of solving problems with lesser budget and be light in the architecture too. First things first, it takes away the infrastructure-related works like monitoring, uptime, maintenance, etc., All your attention can be given to your business problem statement.
It is already been widely adopted by companies across the world in production. Although it can be a promising solution in many cases it should be understood well before adopting for your specific case. Yes, there are scenarios where it does and doesn’t suit and let’s look at in more detail.
Serverless compute, in simple words..
To execute any piece of code, it requires a compute resource to run it. The conventional deployments provision a server and the server will be managed and maintained. In the case of serverless, the cloud providers dynamically manage the provisioning of the compute resources on-demand.
Think of it as an event-driven system in the cloud. You trigger and it runs and every time you trigger it, it gets invoked.
Let’s look at the characteristics,
- You no longer need to worry about the underlying servers. Reason being, they are not managed by you anymore and the responsibility is taken by the Cloud providers.
- You don’t need to manage and maintain servers to be running 24x7. So, you can do the same at a reduced cost! Serverless compute products’ pricing is typically based on the number of execution and the number of seconds/milliseconds they were running.
- It comes with a preset time limit in most of the cases for the execution to complete. So, make sure you are aware of what you perform in your code and how much time it could take. Short running code is the most suitable workloads.
- As the serverless compute is managed by the cloud, it would not be possible to colocate all your code together if frequent inter-module communication is required. Loosely coupled code suits the most.
- Stateless execution is most suited as the compute resources gets dynamically provisioned, the state/data gets destroyed when the execution completes.
- Provisioning multiple environments are easier as you don’t need to provision servers and manage them for dev, test, stage, etc., etc.,
- As this is event-driven, your code gets executed as many times as it gets triggered, means automatically scale up and down. Everything is handled under the hood by the cloud provider.
Let’s dive into more details on serverless computing in the upcoming article.