One of the biggest advantages of Serverless is its pricing model which is more fine-grained than VMs and Containers on the cloud. More importantly, one could see the real advantage of pay per use model in the case of Serverless than VMs and Containers because you are not continuously running these services and they come up when invoked, executes and shuts down as soon as the execution is over. This allows cloud providers to offer much lower pricing than other compute services. Is the pricing model as simple and cost effective as many of us believe? This is the question we are going to address in this post.
Typical serverless cost includes number of invocations, CPU and RAM usage, API Gateway costs, Storage and Network costs. Then add in the costs of other cloud services
The biggest selling point for AWS Lambda, one of the early Serverless offerings, is the pay per invocation model and the cost effectiveness of these invocations. However, the devil is in details. For example, here is the pricing model for AWS Lambda (may vary by duration):
Number of Function Requests – $0.20 per 1M requests
Duration of invocation – $0.0000166667 for every GB-second
Memory – Charged as price per 100 ms and it is $0.0000002083 for 128 MB for every 100 ms
and they have a different pricing model for provisional concurrency which gives levers to avoid problems due to cold start issues. The pricing model is
Provisioned Concurrency – $0.0000041667 for every GB-second
Requests – $0.20 per 1M requests
Duration – $0.0000097222 for every GB-second
Other than this, you have to pay the network bandwidth charges at AWS EC2 pricing. Then you have costs for storage and other cloud services used. Just understanding the cost of your application in AWS Lambda itself will have a huge learning curve. We cannot blame the cloud providers for this pricing complexity. It is difficult to price compute beyond the usual chunks used for Virtual Machines and Containers. The complexity is a result of cloud providers trying to offer more fine-grained pricing.
Catalyst, one of the recent Serverless offerings in the market, tries to simplify this complexity by bringing in a credit based model. While you pay pennies for the compute, you could buy credits at a fixed price and use it for backend, AI and other services. They feel that this takes the complexity out of pricing and makes it easy to calculate pricing for the apps.
Different providers offer different pricing model but they all focus on allowing developers to slide and dice various services and pay only for the time they use these components. Serverless computing does offer dramatic cost savings compared to VMs and Containers. However, it is important that you understand the pricing model properly before architecting the application. Without a proper understanding, you may end paying more than VMs and Containers. This is where a more simplified pricing like the one offered by Catalyst can help developers.
Pricing Considerations for Developers
- Don’t ignore the network and storage costs. Sometimes, it could add up to make using serverless compute more expensive. Similarly, project the number of API requests through gateway and include in your cost calculations to avoid surprises
- Almost every cloud provider including AWS Lambda, Catalyst and others offer a free tier. Take advantage of the free tier
- Keep in mind, when doing cost comparisons with VMs and Containers, that Serverless pricing already takes care of high availability at no cost and without the operational overhead needed to ensure HA
- Some services like AWS Lambda throttle CPUs in the case of smaller memory based executions. Check if your Serverless provider throttle CPUs. Sometimes you may have to use higher memory units to avoid throttling
- For certain applications, the traffic may require constant invocations of Serverless compute. In such cases, running VMs and Containers 24/7 may be cost effective. But for many applications and most with irregular traffic patterns, Serverless offers dramatic savings
- Never discount the operational overhead you save with Serverless, especially when using hosted Functions as. a Service offerings
Serverless is a game changer in cloud pricing. It offers dramatic cost efficiencies and removes operational complexities. Developers can focus on their code without worrying about compute environments. But, the pricing model is complex and it is important you understand the model and pick a provider that offers a simplified pricing for your needs.