Sleep, wake and stop

Last updated 2 November 2026

View .md

Machines are not open yet. These pages describe Machines as they will open; until then, a create answers region_not_offered (422), “Machines are not offered in any region yet.”

Know when your Machine runs and when it does not, so that its work and its bill behave as you expect.

  • A request to one of its ports wakes it.
  • An active connection prevents sleep for being idle.
  • Without an active connection, it sleeps within 10 minutes by default, or sooner when it is idle.
  • Every wake starts your image fresh; every synced commit in its database, and every flushed write to its Volume, is intact.

What Tonbo promises about all of this is on Sleep guarantees.

What wakes it

A request to one of its ports. The request waits while the Machine starts (see The first request).

What keeps it awake

An open request, Server-Sent Events response or WebSocket to one of its ports, whatever it carries. Work your program does after it answers does not, so finish the work before you answer or keep the request open while it runs (see the rule). Connections your program opens itself, to a database, an API or anything else, prevent sleep for being idle while they are active.

When it sleeps

Its sleep-after time without an active connection: 10 minutes by default, and anything from 30 seconds to 24 hours you set (see Change a Machine). No setting keeps it awake for ever. Tonbo may put it to sleep sooner, after about 2 minutes, when no request and no connection of its own is open and it uses almost no CPU or network. When Tonbo removes or patches a host, it may also put a Machine to sleep with requests open (see Request guarantees). You can put it to sleep yourself at any time:

tonbo machine sleep app

What a wake starts with

Every sleep stops the Machine, and every wake starts your image again on fresh root and scratch disks with empty memory. Its database is intact, and so is its Volume, mounted at its path. Nothing else comes back: no process, no file outside the Volume, no open connection. Keep what must last in the database or on the Volume (see Keep data in its database and Volume and Sleep guarantees). A change of image, command, env or shape takes effect at the next wake (see Deploy a change).

Stopping

  • Every sleep sends your program SIGTERM and stops the Machine its stop grace later (10 seconds by default, at most 230), or at most 60 seconds when your credit runs out.
  • A crash, a program that runs out of memory or the loss of a host sends no signal.

So make data durable with synced() as you go, never only on SIGTERM (see Stop cleanly).

When a wake is refused

A request that cannot wake the Machine is answered with a reason and, when trying again helps, Retry-After: for example payment_required, capacity or crash_backoff. The bounds of a wake are on Limits, and the exact rules behind them, with the thresholds of the early sleep, on Activations.