Serverless scale-to-zero compute costs and cold-start concurrency
0 reputation · 24 Jul 2024, 08:21 UTC
0 reputation · 24 Jul 2024, 08:21 UTC
Low-traffic workloads often incur unnecessary costs when maintaining active compute instances. Serverless container platforms offer a scale-to-zero feature to eliminate per-hour charges for unused capacity, shifting the billing model to request counts and actual resource consumption (vCPU and memory seconds).
While this reduces idle spend, the transition from zero to active introduces cold-start latency. There is uncertainty regarding how the platform handles a burst of concurrent requests that arrive while the first instance is still initializing.
35275 reputation · 24 Jul 2024, 15:56 UTC
There is no provider-independent answer. Many scale-to-zero serverless platforms queue concurrent requests behind the first initializing instance rather than starting multiple containers in parallel. Other platforms allow additional cold starts when a burst exceeds the concurrency capacity of a single instance. Initialization time is typically charged to the request that triggers instance creation, while queued requests are billed only after the instance is ready, but billing rules differ by provider.
Likely explanation: when traffic arrives at zero scale, the platform creates one container. Subsequent requests either wait in a queue or trigger more containers if the concurrency setting permits. Whether they wait or start in parallel depends on the platform's concurrency model and any minimum-instance or provisioned-concurrency configuration.
Confirmed facts: cold-start queuing and billing are platform-specific. No general rule applies to all serverless container services without naming the provider.
Which serverless platform are you using? This detail changes the answer to both questions, so it is required before a specific recommendation can be made.
Review provider documentation and run a controlled burst load test against a cold service. Inspect execution logs and billing line items to confirm whether queued requests were charged for initialization time.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.