# Cold Start

URL: https://softwaredictionary.org/terms/cold-start
Category: DevOps & Cloud
Last updated: 2026-10-06
In Turkish: soğuk başlangıç

In short: A cold start is the extra delay when a serverless platform must create a new function instance, start its runtime and run setup code before handling a request.

## What is a cold start?

Serverless platforms such as AWS Lambda, Azure Functions and Google Cloud Run don't keep your code running all the time. When a request arrives and no instance is ready, the platform has to create one: it allocates a lightweight virtual machine or container, downloads the code or image, starts the runtime, such as Node.js, Python or the Java virtual machine, and runs your initialization code. Only then can it handle the request. That extra wait is the cold start.

Once an instance exists, the platform keeps it for a while and reuses it, so the next requests are warm starts that skip the setup. Cold starts happen whenever a new instance is needed: after the function has been idle, after a new deployment, and when traffic grows and the platform scales out. AWS says they typically affect under 1% of Lambda invocations and last from under 100 milliseconds to over a second; large packages, heavy frameworks and runtimes such as Java and .NET tend to take longest.

Teams shorten cold starts by keeping deployment packages small, loading libraries only when they are needed and creating clients such as database connections once, outside the request handler, so warm requests reuse them. Platforms also offer paid ways to keep instances ready: provisioned concurrency on AWS Lambda, minimum instances on Cloud Run and always-ready instances on Azure Functions. Lambda SnapStart, available for Java, Python and .NET, starts new instances from a snapshot of an already initialized one. Platforms built on V8 isolates, such as Cloudflare Workers, start code in a few milliseconds, so their cold starts are barely noticeable.

A cold start is often confused with general slowness. It only adds time to the first request handled by a new instance; if every request is slow, the cause lies elsewhere, in the code, the database or the network. The term is also used outside serverless, for an app launching from scratch or a cache that starts empty, but the idea is the same: the first use pays for setup that later uses skip.

## Key takeaways

- A cold start is the setup delay when a platform must start a new function instance.
- Warm starts reuse an existing instance and skip that setup.
- Cold starts follow idle periods, new deployments and scaling out.
- Small packages and initialization outside the handler make them shorter.
- Provisioned concurrency and minimum instances keep instances ready; SnapStart makes new ones start faster.

## Example: Setup outside the handler runs only on a cold start (AWS Lambda, Python)

```python
import boto3

# Runs once per new instance, during the cold start
s3 = boto3.client("s3")

def handler(event, context):
    # Runs on every request; warm starts reuse the client created above
    obj = s3.get_object(Bucket="reports", Key=event["key"])
    return {"size": obj["ContentLength"]}
```

## Frequently asked questions

**How long does a cold start take?**

It depends on the platform, the runtime and the size of the code. AWS describes Lambda cold starts as lasting from under 100 milliseconds to over a second; small Node.js or Python functions sit at the fast end, and large Java or .NET applications without SnapStart at the slow end.

**How can I avoid cold starts?**

You can make them shorter by keeping packages small and initialization light, and avoid most of them by paying for instances that are always ready, such as provisioned concurrency on AWS Lambda or minimum instances on Cloud Run. Sending regular warm-up requests is an older workaround that doesn't help when traffic needs more instances.

**Does every request have a cold start?**

No. Only a request that has to be handled by a new instance does. Requests that arrive while an instance is still alive are warm starts and skip the setup.

## Sources

- [AWS Lambda documentation: Understanding the Lambda execution environment lifecycle](https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtime-environment.html)
- [AWS Lambda documentation: Configuring provisioned concurrency for a function](https://docs.aws.amazon.com/lambda/latest/dg/provisioned-concurrency.html)
- [Cloud Run documentation: Set minimum instances for services](https://docs.cloud.google.com/run/docs/configuring/min-instances)

---

Software Dictionary: https://softwaredictionary.org/ · https://softwaredictionary.org/llms.txt
