Better Programming

Advice for programmers.

Follow publication

Member-only story

When Is Serverless More Expensive Than Containers?

Allen Helton
Better Programming
Published in
6 min readNov 3, 2022
Image by user18526052 on Freepik

I talk to a lot of people about serverless. Shocking, I know.

When discussing the viability of serverless for production applications, I’m often hit with the same two arguments:

Cold starts are so bad we can’t use serverless” and “aren’t you worried about the cost at scale?

We’ve already covered why we should stop talking about cold starts. But the question about cost at scale is one we haven’t covered yet.

It’s also not a black-and-white argument.

Serverless applications offer significant total cost of ownership (TCO) advantages compared to containers. You don’t have to spend time (which is money) on server maintenance, installing patches, rebooting services in an invalid state, managing load balancers, etc….

Source

But for the sake of argument, we can compare the total bill and put the other contributing factors aside. Those can be hard to prove objectively when you haven’t sold your audience on the concept yet.

So comparing dollars and cents strictly is our objective. Again a difficult concept to prove. Comparing provisioned services like EC2 with a pay-for-what-you-use service like Lambda is difficult but impossible.

I often hear that serverless is expensive “at scale,” but nobody can effectively communicate what that amount of traffic actually is.

I had a great discussion with Jeremy Daly and Yan Cui on the subject a couple of weeks ago. We all concluded that certain workloads are significantly more expensive to run serverless, but the tipping point is usually difficult to objectify. The best thing we can do is analyze our spending on a heuristic-based approach.

Let’s dive into some numbers.

Comparing EC2 and Lambda

Create an account to read the full story.

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

Allen Helton
Allen Helton

Written by Allen Helton

I am an AWS serverless hero with a strong focus on API design and standardization, event-driven architectures, and software automation.

Write a response