Skip to content

Sleep when idle ​

A web service with Sleep when idle scales to zero replicas after a period without requests, and wakes up on the next request. While it sleeps it uses no CPU or memory, so it costs nothing apart from any volume.

Functions always work this way: they scale to zero after their idle window.

This suits staging environments, internal tools, demos and side projects that are not used around the clock.

Turning it on ​

In Settings → Deploy, enable Sleep when idle and set Sleep after (minutes without requests, 1 to 1440, default 10).

Requirements:

  • the service kind is web (workers, cron jobs and databases do not sleep);
  • it has at least one public domain: only requests to its domains wake it;
  • it has no public TCP port: TCP connections can't wake it, so it stays awake while one is on.

Waking up ​

When a request arrives for a sleeping service, Fjordrun holds the request, starts the service and forwards the request as soon as the app is ready. The first request waits for the start-up (a few seconds for most apps; longer for heavy frameworks). Later requests are served normally.

The wake-up waits up to the service's healthcheck timeout (at least 60 seconds). A fast start helps: keep start-up work small and avoid running migrations on every boot if they are slow.

Things to know ​

  • Requests over the private network (<service>.<env>.internal) do not wake a sleeping service. Keep services that others call privately always on.
  • Background work inside the app (timers, in-process schedulers, open WebSocket connections without traffic) stops while it sleeps. Use a cron service for scheduled jobs.
  • Databases referenced by a sleeping app keep running and are billed as usual.

Pricing ​

No CPU or memory usage is billed while a service sleeps. See Usage-based pricing.

Fjordrun is hosted in the EU (Hetzner, Nuremberg, Germany). Private beta.