Serverless cold starts: why the first request is slow
A cold start is the extra time a serverless platform needs to start a new instance — load the runtime, your code and its dependencies — before handling a request.
What causes it
Platforms keep a pool of warm instances. When traffic grows faster than the pool, new instances start cold and those requests pay hundreds of milliseconds (or seconds) extra. Spiky traffic, large packages and heavyweight runtimes make it worse.
How to recognise it
- Latency spikes at the start of traffic bursts
- Lambda “Init Duration” in REPORT lines
- p99 latency far above p50 for low-traffic functions
Error messages you will see
| Error | Seen in |
|---|---|
REPORT … Init Duration | AWS Lambda |
How to fix it
- Use provisioned concurrency
- Keep the package small
- Smooth traffic spikes
Reproduce it in the simulator
Open the simulator, build a small architecture and use Fault injection in the inspector, or push traffic past a component’s capacity.
Learn more
Part of the guide Load balancing and capacity planning.