• Docs
  • Talk to an expert
Blog
Blog
BlogProductCase studiesNewsInsights
Blog

What is a cold start?

performancecontainersAI Agents
02 December 2026
Share
This post is also available in German and in French.

TL;DR

  • A cold start is the delay when something has to start from nothing before it can handle work, such as a serverless function, a container, or an app.
  • A warm start reuses something already running, so it's fast.
  • Cold starts come from several steps: finding capacity, loading the code or image, starting the language runtime, and the app's own setup.
  • They matter most for things that scale to zero, start on demand, or scale up suddenly, including AI agents that start a fresh environment for each task.
  • You reduce them with smaller images, faster startup code, keeping some capacity running, and choosing always-running services for latency-sensitive work.
  • On Upsun Cloud, apps and workers run all the time, so web requests don't hit cold starts, while task containers start on demand.

A cold start is the extra time it takes to handle a request or job when nothing is running yet to handle it. The system has to create a new instance of your code, load it, and get it ready before it can do the actual work.

You notice cold starts as a slow first request after a quiet period, or a delay before a background job begins. This guide explains where cold starts happen, what causes them, and how to reduce them.

Cold start vs warm start

Key takeaway: a cold start creates something new, a warm start reuses something already running.

 Cold startWarm start
What happensA new instance is created and initializedAn instance that's already running handles the work
SpeedSlower, from a fraction of a second to many secondsFast
When it happensThe first request after idle time, a sudden traffic spike, or a new on-demand jobOngoing traffic to running instances

 

Where cold starts happen

Key takeaway: anything that starts on demand or scales from zero can have cold starts.

WhereWhy it happens
Serverless functionsPlatforms stop idle functions and start them again when a request arrives
Containers that scale to zeroServices that shut down when idle must start a container for the next request
AutoscalingNew instances added during a spike need time before they're ready
On-demand jobsBatch jobs or tasks that start a fresh container for each run
AI agentsAgents that start a new, isolated environment for each task, and AI apps that load large models into memory

 

What causes a cold start

Key takeaway: a cold start adds up several steps, and the slowest is often your own app's startup work.

StepWhat happensWhat makes it slow
Find capacityThe platform finds somewhere to run the new instanceBusy platforms, or large resource requests
Load the image or codeThe container image or code package is fetchedLarge images with unneeded files
Start the runtimeThe language runtime starts, such as Node.js, Python, or JavaSome runtimes take longer to start than others
Initialize the appYour code loads libraries, reads configuration, and connects to databasesHeavy frameworks, many dependencies, slow connections
Warm cachesThe app fills caches or loads models into memoryLarge caches or AI models

 

How to reduce cold starts

Key takeaway: make startup lighter, or keep something running so cold starts happen less often.

ApproachHow it helps
Keep a minimum runningKeep at least one instance always running for latency-sensitive services
Use smaller imagesRemove build tools and unneeded files, so there's less to load
Start fasterLoad only what's needed at startup, and do heavy setup later or in the background
Reuse connectionsOpen database connections once per instance, not per request
Warm up before trafficCheck an instance is ready before sending it requests
Choose the right modelUse always-running services for frequent, short work, and on-demand containers for occasional, longer jobs

 

Cold starts and AI agents

Key takeaway: isolating every agent task in a fresh environment adds a startup cost, which is usually worth it for safety.

Running each AI agent task in its own fresh, isolated environment is good for security, because nothing carries over between tasks. It also means each task pays a startup cost. For tasks that run for minutes, a short start is a small price for the isolation. For many tiny, frequent tasks, a long-running worker may suit better. 

Our guide What is an AI agent sandbox? explains why isolation matters.

Cold starts on Upsun Cloud

Key takeaway: on Upsun Cloud, apps and workers are always running, and task containers start on demand, so choose based on how often work arrives.

The Upsun docs on tasks compare the ways to run code:

 AppsWorkersTask containers
LifecycleAlways runningAlways runningStart on demand, run to completion, then removed
Cold startsWeb requests reach running instancesJobs are picked up by running workersEach run starts a new container
Good forWeb trafficFrequent background jobsOccasional heavy jobs, data exports, background AI agents

 

A few details from the docs:

  • Task containers run for up to an hour by default, configurable up to a day.
  • By default, up to three task runs can happen at once. Further triggers wait in a queue, and the limit is lower during a trial.
  • When autoscaling adds an app instance, a post_start command can check the app is ready before the router sends it traffic, so the first visitors don't hit an instance that's still starting up.

For work that arrives constantly, use a worker. For occasional, heavier jobs that benefit from a fresh, isolated container, use a task container. Our guide Background jobs vs cron jobs: which do you need? compares the options.

You can deploy on Upsun Cloud free for 15 days, with no card needed, or see how task containers work on Upsun Cloud.


 

Frequently asked questions (FAQs)

What is a cold start in serverless?
The delay when a serverless platform starts a new instance of a function to handle a request, because no instance is already running.

What is the difference between a cold start and a warm start?
A cold start creates and initializes a new instance. A warm start uses an instance that's already running, so it's faster.

How long does a cold start take?
It varies widely, from a fraction of a second to many seconds, depending on the platform, the image size, the runtime, and the app's startup work.

How do I avoid cold starts?
Keep a minimum number of instances running, make your app start faster, use smaller images, and use always-running services for latency-sensitive work.

Do containers have cold starts?
Yes, when a new container has to be started to handle work, such as when scaling from zero or adding instances during a spike.

Why do AI agents have cold starts?
Agents often start a fresh, isolated environment for each task, and AI apps may need to load large models into memory before they can respond.

Stay updated

Subscribe to our monthly newsletter for the latest updates and news.

Deploy possibility.
Try Upsun for free.

Build with DispatchDeploy on Cloud