Work out serverless vs container cost instantly with clear inputs, formula shown and shareable results.
Serverless cost is GB-seconds — requests times duration times memory in gigabytes — plus a per-request charge, so it scales exactly with usage and costs nothing when idle. Containers cost the same whether busy or not. The crossover therefore depends on utilisation: spiky low-duty-cycle workloads favour serverless, sustained high-volume workloads favour containers.
Serverless cost
GB-seconds = requests x duration x memory GB; cost = GB-seconds x per-GB-second rate + requests / 1e6 x per-million rate
Not necessarily. More memory means proportionally more CPU, so a function may finish fast enough that GB-seconds fall. Always measure across memory settings.
Cold-start latency, API gateway charges, and the operational cost of container orchestration. The last frequently outweighs the compute difference.