Articles

Scale to zero without slow cold starts

Gregale scales idle apps to zero without booting them again: an app pauses in memory about a second after its last request and resumes in about a millisecond, and after 10 minutes it parks as a memory snapshot that wakes with its process already running.

Updated

Scale to zero without slow cold starts by waking apps from a memory snapshot instead of booting them. On Gregale an idle app is not shut down and started again. About a second after its last request it pauses in memory, stops being billed, and resumes in about a millisecond. After 10 minutes idle it parks as a snapshot on disk, using no memory at all, and the next request restores that snapshot with the process already running. In Gregale's published benchmark, 100 snapshot restores of a 256 MiB app took 95 ms at the median and 138 ms at p95, measured inside the platform.

Why scale to zero usually means cold starts

Scaling to zero saves money because nothing runs while nobody is using the app. The cost is the first request after an idle period. On most platforms that request waits for a full start: a container or VM boots, the runtime loads, the framework imports its code, opens database connections and fills its caches. For a typical web app that takes seconds, and for a JVM app longer. So teams turn scale to zero off and pay for an always-on instance.

The three idle states on Gregale

StateWhenMemoryNext requestBilled
PausedAbout a second after the last requestKept, pausedResumes in about a millisecond, caches intactNo
FrozenAt the app's idle timeout, on nodes that enable itKept, pausedResumes in a few milliseconds, caches intactNo
ParkedAfter 10 minutes idle, or when the node needs the memoryNone: a snapshot on diskRestores the snapshot of the running processNo

Any packet addressed to a paused app resumes it, such as a reply on a connection the app opened. An app whose timers or background threads keep it busy is not paused: it keeps running, and is billed, while it works. You can declare what your app tolerates in gregale.yaml (lifecycle.pause: between_requests, when_idle or never).

What a wake restores

Gregale takes the snapshot right after your app becomes ready on deploy. Just before the capture it sends up to 20 requests to your health check or a warm-up path you name, so the snapshot holds a runtime that has already loaded, compiled and connected. Every wake starts from that state, not from main(). JIT runtimes gain the most: in Gregale's benchmark the first request after a wake was 0.5–0.8 s faster on Java and within noise on Go, Node and Python.

On Pro and Scale you can opt in to a warm snapshot, taken after an instance has served a few requests, so wakes also skip work your framework does on first use. Because every woken instance starts from the same memory, Gregale repairs the guest clock and kernel entropy on each restore, and your app can run an after_restore hook (in beta) to reconnect or refresh its own state.

A full cold boot happens only when a node has no usable snapshot, for example after it dropped one from its cache. Gregale then boots, primes and snapshots a fresh instance in the background, unbilled, so later wakes restore again.

The numbers, and what they cover

Firecracker snapshot restore on SSD measured 100 sequential restores of a 256 MiB Go app on one SSD-backed node: 95 ms at the median, 138 ms at p95 and 149 ms at worst. That is the platform interval, between the scheduler's wake-started and wake-completed events. A public request also includes network transit and your app's own response time, so it takes longer. The samples, the computed distributions and the analysis script are published with the report.

How other platforms handle idle apps

PlatformWhat happens when idleFirst request after idle
GregalePauses about a second after each request; parks as a memory snapshot after 10 minutes; on every planResumes in about a millisecond when paused; restores a snapshot when parked
RenderFree web services spin down after 15 minutes without inbound traffic; paid instances run all the timeSpinning back up "takes about one minute"
Fly.ioMachines can be stopped or suspended when the app has excess capacityA suspended Machine resumes in "a few hundred milliseconds"; a cold start "about 2 seconds or more"
RailwayOpt-in Serverless sleeps a service 5 to 10 minutes after its last outbound trafficNo stated wake time; the first request "may return a 502 Bad Gateway"
HerokuEco dynos sleep after 30 minutes; Basic and larger dynos run all the timeNot compared here

Fly.io's suspend is the closest to Gregale's approach: it also resumes a Machine from memory. Gregale adds the pause between individual requests, about a second after each one, which is also when billing stops.

Sources, checked 2026-11-25 unless noted: Render free instances, Fly.io autostop and autostart, Railway serverless, Render pricing and Heroku pricing (checked 2026-11-24).

When to keep an instance warm anyway

A restore is fast but not free. If your app answers a request every few seconds all day, it rarely parks and the question does not arise. If every millisecond of the first request matters, keep instances running on Pro or Scale; each one is billed like any running instance:

bash
gregale app my-api --min 1   # always keep 1 instance warm
gregale app my-api --min 0   # back to scale-to-zero (default)

See How scaling to zero works for every setting, and Gregale pricing for what running time costs.

Questions

How do I avoid cold starts when scaling to zero?

Wake the app from a snapshot of its running process instead of booting it. Gregale pauses an idle app in memory about a second after its last request and parks it as a memory snapshot after 10 minutes, so the next request never waits for a full boot unless the node has no usable snapshot.

How fast does a parked app wake?

In Gregale's published benchmark, 100 snapshot restores of a 256 MiB app took 95 ms at the median and 138 ms at p95, measured inside the platform. A public request also includes network transit and your app's response time.

Am I billed while the app is idle?

No. Billing stops about a second after each request, when the app pauses, and a parked app uses no memory. An app that keeps working in the background is billed while it works.

Can I keep an instance warm anyway?

Yes, on Pro and Scale: gregale app my-api --min 1 keeps an instance running, billed like any running instance.