Cold start
The extra delay when a serverless function or a new server instance has to start up before it can handle a request.
Last updated
What it is.
Serverless platforms shut down idle instances. When a request arrives and no warm instance is ready, the platform has to start one: load the runtime, your code and its dependencies, and open connections. That first request waits. Later requests on the same instance are warm and fast.
Cold starts depend on the runtime, the size of the code bundle, how much work runs at startup and the platform. Edge functions on lightweight runtimes usually start faster than full server runtimes.
Why it matters
Cold starts hit the least used parts of an app hardest, and they often land on the first request a user makes. For user-facing APIs they can make an app feel slow even when average numbers look fine.
In a product build
We keep function bundles small, move heavy setup out of the hot path, reuse connections through connection pooling and measure cold starts separately in APM. Where steady low latency matters more than idle cost, we run that part on always-on containers.
Common mistakes.
- 01
Opening a new database connection on every cold start, which can exhaust the database.
- 02
Bundling the whole codebase into every function.
- 03
Judging performance by averages that hide the slow first requests.
Related terms.
- ServerlessA cloud model where the provider runs your code on demand and manages the servers, and you pay for what you use rather than for idle machines.
- Edge functionA small piece of server code that runs on a CDN's servers around the world, close to the user, instead of in one central region.
- Connection poolingKeeping a set of open database connections and sharing them across requests, instead of opening a new connection for each one.
- AutoscalingAutomatically adding or removing computing capacity, such as servers or containers, as the load on a system goes up or down.
- APM (application performance monitoring)Tools that measure how fast and how reliably an application handles requests, and show which part of the code or which call is slow.
Guides and pages
Browse the full glossary or read answers to common questions.