rembrembdocs

With Fly Proxy autostop/autostart, you can scale your app for peak loads and run those Machines only when needed to save on resource costs; you don’t pay for Machine CPU and RAM when they’re in a stopped or suspended state. Fly Proxy automatically stops (or suspends) and starts existing Machines based on incoming requests to your app, and you have the option to keep a minimum number of machines running at all times in your primary region.

Autostop/autostart works for Fly Apps with a service configured in the fly.toml file, which generally covers publicly available apps that accept requests from the internet. But you can also use autostart/autostart for private apps by setting up services and using a Flycast private IPv6 address. See Flycast - Private Fly Proxy Services and Autostop/autostart private apps.

For apps that shut down automatically when idle and don’t need autostop, the Fly Proxy can still restart your app’s Machines when there’s traffic.

Learn how to configure autostop/autostart.

How Fly Proxy autostop/autostart works

Fly Proxy runs a process to determine whether an app has excess capacity every few minutes.

Autostop/autostart only works on existing Machines and never creates or destroys Machines for you. The maximum number of running Machines is the number of Machines you’ve created for your app using fly scale count or fly machine clone. Learn more about scaling the number of Machines.

Fly Proxy process to stop or suspend Machines

When auto_stop_machines is set to "stop" or "suspend" in your fly.toml, the proxy looks at Machines running in a single region and uses the concurrency soft_limit setting for each Machine to determine if there’s excess capacity. If the proxy decides there’s excess capacity, it stops or suspends exactly one Machine. The proxy repeats this process every few minutes, stopping or suspending only one Machine per region, if needed, each time.

If you have the kill_signal and kill_timeout options configured in your fly.toml file, then Fly Proxy uses those settings when it stops a Machine.

Fly Proxy determines excess capacity per region as follows:

Fly Proxy process to start Machines

When auto_start_machines = true in your fly.toml, the Fly Proxy restarts a Machine in the nearest region when required.

Fly Proxy determines when to start a Machine as follows:

How Fly Proxy behaves without autostart/autostop

Fly Proxy still routes requests to your app’s Machines even when auto_stop_machines is not set, or when auto_start_machines is explicitly set to false in your fly.toml file.

We recommend setting auto_start_machines = true and auto_stop_machines = "stop" or "suspend" in your fly.toml file to reduce idle resource usage and improve availability for apps that need to scale based on demand.