Skip to content

Scale to Zero

Environments can automatically stop when idle and wake up on the first request. This is ideal for staging, preview, and development environments that don’t need to run 24/7 — saving resources without manual intervention.

Enabling scale to zero

  1. Open your project and go to the environment settings
  2. Toggle Scale to zero on
  3. Set the idle timeout (how long without traffic before the environment sleeps)
  4. Click Save

Idle timeout limits

PlanMinimum idle timeout
Starter15 minutes
Pro5 minutes
Business5 minutes
Enterprise5 minutes

The default idle timeout is 15 minutes.

How it works

Idle detection

Stackpad checks ClickHouse access logs every 60 seconds. If no traffic has reached any externally-exposed service in the environment within the idle timeout window, the environment is put to sleep.

When sleeping:

  • All service containers are stopped
  • CPU and memory reservations are released
  • Resources become available for other workloads

Wake-up flow

When the first request hits a sleeping service:

  1. Caddy serves a branded loading page (no 502 errors)
  2. Services start in the background — databases and caches first, then web apps (dependency ordering)
  3. The loading page auto-refreshes every 2 seconds
  4. Once the service is healthy, the page redirects to the actual application

For API clients (non-browser requests), Stackpad returns a JSON response:

{
"error": "Service is sleeping",
"status": "waking",
"retryAfter": 10
}

With a Retry-After: 10 header, so well-behaved HTTP clients retry automatically.

Per-service overrides

By default, all services in an environment follow the environment’s scale-to-zero setting. You can override this per service:

  • Allow this service to sleep — toggle on/off per service
  • Force always awake — keep a specific service running even when the environment sleeps
  • Force always sleep — stop a service even when the environment is awake

Configure overrides in the service’s Settings tab.

Keep-awake timer

Temporarily prevent an environment or service from sleeping — useful during debugging sessions or active development:

  • Quick options: 1 hour, 4 hours, 8 hours
  • While active, the keep-awake timer overrides the idle timeout
  • A badge shows the remaining time in the dashboard
  • Click Clear to remove the timer early

Keep-awake limits

PlanMaximum keep-awake duration
Starter4 hours
Pro24 hours
BusinessUnlimited
EnterpriseUnlimited

Cron job awareness

Environments with active cron jobs are kept awake automatically — you don’t need to manually configure keep-awake timers for environments running scheduled tasks.

Service type restrictions

Service typeCan sleep?
Web appsYes
DatabasesYes
CachesYes
Background servicesYes
GPU servicesNo
Object storageNo

GPU and object storage services are not Docker containers and cannot be paused.

What’s next?