RunCost
Serverless vs Container Cost Calculator
Serverless bills per request; containers bill for idle time. Find the volume where that flips.
Serverless versus always-on containers by request volume
Serverless bills per invocation and per GB-second; containers bill by the hour regardless of traffic. Rows use $0.20 per million requests, $0.0000166667 per GB-second, and $0.05 per container-hour.
| Requests/month | Duration | Memory | Containers | Serverless | Container | Cheaper |
|---|---|---|---|---|---|---|
| 1 M | 200 ms | 0.5 GB | 2 | $1.87 | $73.00 | Serverless |
| 10 M | 200 ms | 0.5 GB | 2 | $18.67 | $73.00 | Serverless |
| 50 M | 200 ms | 0.5 GB | 2 | $93.33 | $73.00 | Container |
| 10 M | 1,000 ms | 1 GB | 2 | $168.67 | $73.00 | Container |
| 100 M | 200 ms | 0.5 GB | 4 | $186.67 | $146.00 | Container |
Duration and memory matter as much as request count: row four has a fifth of row three's traffic but costs more, because each invocation runs five times longer at double the memory.
A serverless versus container cost calculator settles one of the most common architecture arguments with arithmetic instead of opinion. The two models bill on fundamentally different axes. Serverless charges per invocation plus compute measured in gigabyte-seconds, so cost scales almost perfectly with traffic and falls to nearly nothing when nobody is using the service. Containers charge for provisioned capacity by the hour whether they are saturated or idle, so cost is flat and the price of low traffic is paid in wasted capacity. Somewhere between those curves is a break-even volume, and knowing where it sits for your workload is what turns the debate into a decision.
The calculation prices both sides from the same workload description. Serverless cost combines an invocation charge — requests divided by a million, times the per-million rate — with a compute charge derived from gigabyte-seconds: requests multiplied by average duration in seconds multiplied by allocated memory in gigabytes, priced per GB-second. Container cost is instances multiplied by hourly rate multiplied by 730 hours, the standard month. Because serverless cost per request is effectively constant for a given duration and memory setting, the break-even volume falls out as a simple ratio: the container's fixed monthly cost divided by the serverless cost per request. Below that volume serverless is cheaper; above it, containers are.
Two inputs deserve more care than they usually get. Memory allocation multiplies the compute charge directly, and over-provisioning memory on a serverless function is one of the most common sources of surprise bills — though the relationship is not purely linear, because more memory often means proportionally more CPU and therefore shorter duration, which can be cheaper overall. Average duration should come from real percentile data, not a happy-path estimate; long-tail slow requests contribute far more GB-seconds than their share of traffic suggests. Beyond cost, the source research is right that this decision includes concurrency limits, cold starts, idle floor, egress, and operational time. Serverless removes capacity planning and patching but imposes execution-time ceilings and cold-start latency; containers give predictable performance and unlimited execution but require scaling policies, health checks, and on-call attention. Use this calculator to establish where cost stops favouring your current choice, then weigh those operational factors before moving. It prices compute only, excluding data transfer, storage, load balancers, and the engineering time to migrate.
The break-even is a ratio, not a guess
Because serverless cost per request stays constant for a given duration and memory setting, break-even is simply the container's fixed monthly cost divided by that per-request cost. Steady high-traffic services almost always sit above it; spiky, bursty, or low-traffic workloads sit well below — which is why serverless wins decisively for internal tools, webhooks, and anything with idle nights and weekends.
Memory and duration drive serverless cost together
GB-seconds multiply memory by time, so over-allocating memory inflates the bill directly. But raising memory often raises CPU too, shortening duration — sometimes enough to reduce total cost. Measure both at real percentiles rather than the happy path: slow tail requests contribute far more GB-seconds than their traffic share implies.
Frequently asked questions
5M requests/month at 200ms and 0.5 GB, versus 2 containers at $0.08/hr — which is cheaper?
Serverless uses 500,000 GB-seconds: $1.00 in invocations plus about $8.35 in compute, roughly $9.35/month. Two containers cost 2 × $0.08 × 730 = $116.80. Serverless is about $107 cheaper here — containers only make sense above roughly 62 million requests/month at this duration.
When do containers actually become cheaper?
When traffic is high enough and steady enough that the container runs near capacity most of the time. Sustained, predictable load is the container's home ground. If your traffic has quiet nights, weekends, or long idle stretches, you're paying for capacity you aren't using and serverless usually wins on cost alone.
Should I just pick whichever is cheaper?
No. Serverless brings cold-start latency, execution-time limits, and per-account concurrency ceilings; containers bring idle spend, scaling policies, patching, and on-call load. Cost is one input. A modest cost premium is often worth paying to avoid an architecture that fights your latency or operational requirements.
How is this different from the cloud compute cost calculator?
A general compute calculator prices instances you specify. This one compares two different billing models against the same workload and solves for the volume where they cross — which is the actual question when choosing an architecture rather than sizing one you've already chosen.
Related Developer calculators
LLM Workload Cost Calculator
Monthly LLM cost plus the savings from prompt caching and model routing.
OpenAI Video Cost per Approved Minute
True cost per usable minute of AI video, including rejected generations and editing.
OpenAI Agent Run Cost Calculator
Cost of one agent run including context growth, tool results, and retries.
OpenVoice AI Cost per Successful Call
Real cost per completed voice-AI call outcome, after no-answers and transfers.
OpenLast updated: August 8, 2026