- Hands-On Serverless Computing
- Kuldeep Chowhan
- 387字
- 2025-04-04 16:32:06
Scaling costs
With FaaS offerings, horizontal scaling is something that is automatically managed by the cloud provider. They also take care of scaling up and scaling down the infrastructure that is required to process your functions. What this means is that you don't have to spend any time in developing the solutions yourself, everything is automatically taken care of for you. The cloud provider also takes care of ensuring that your functions are run in an environment that is highly available and that it runs across multiple availability zones (AZs) within a region. The other big benefit that you get is that the cloud provider takes care of patching the infrastructure automatically for you and you don't have to worry about it when there are security vulnerabilities to patch for the operating system or runtimes.
The big benefit with FaaS offerings is that for the compute infrastructure you only pay for what you need down to 100 ms execution time (AWS Lambda). Based on what your application traffic patterns are, this could result in huge cost savings for you:

If you look at the preceding diagram, you will see that in a traditional infrastructure environment, you will always scale up in step functions to ensure that you are able to handle the load without effecting your application, but in a serverless/FaaS infrastructure environment, you scale up for what you need and don't have to scale up in step functions to handle your peak load. This gives you tremendous cost savings.
Another example would be, let's say, your application with traditional infrastructure processes only one request every minute and takes 100 ms to process each request, which will result in CPU usage of about 0.2 percent for the entire hour. If you look at the utilization of this infrastructure, it is very inefficient and you could have a lot of other applications running on the same infrastructure without impacting your application. With FaaS offerings, you will only pay for the 100 ms or 200 ms of computer time per minute, as that is what is used by your application and that would result in an overall time of 0.3% for the entire hour, which will result in huge savings for running your application in serverless architecture.