dfw or fra or syd.
How it works
Suspend uses Firecracker snapshots to capture the entire VM state: CPU registers, memory contents, open file handles. When you start a suspended machine, Fly restores from this snapshot instead of cold booting. Typical performance:- Resume from suspend: a few hundred ms
- Cold start: ~2+ seconds for common apps
- TCP connections may survive if the remote side keeps them open
Using Suspend
Manually
Automatically via Fly Proxy
Configure infly.toml:
Machines API
/.fly/api Unix socket directly:
Requirements
A machine can use suspend if it has:- ≤ 2 GB memory (For larger memory sizes, suspend is discouraged due to increased suspend times)
- No swap configured
- No schedule configured
- Been updated since June 20, 2024 20:00 UTC
Limitations and considerations
- Suspend is not currently recommended for large machine memory sizes (> 2 GB)
- Suspending many machines at once is not recommended
- Some logs may be lost after resume
- Unlike stop, suspend does not reset the machine’s
rootfs - On resume, the clock can lag a few seconds until NTP syncs
Always design for both resume and cold start paths.
Snapshot behavior with suspend
Snapshots aren’t guaranteed to persist. Cold starts may happen if:- You deploy a new version of your app — deployments rebuild the machine image, which invalidates the old snapshot. Since a snapshot is a literal memory dump of the old process, resuming it after you’ve swapped in new code or dependencies would be unsafe and unpredictable.
- The machine is migrated to a different host
- The snapshot file is lost or corrupted — Hardware failures, space reclamation, or corruption can cause them to be deleted
- We perform system maintenance or updates
Volume behavior with suspend
Suspend automatically saves a machine’s memory state to persistent storage. You don’t need to attach a volume for suspend to work, and the snapshot isn’t stored on a volume. If your machine does have an attached volume, the volume and its data aren’t affected by suspend and resume. It helps to think of the machine snapshot and the volume as separate things:- The snapshot is the saved CPU and memory state, managed by Fly. It can be discarded, for example, during a deploy, which forces a cold start.
- The volume is your persistent storage. Its data survives suspend, resume, and cold starts, just as it does across a normal stop and start.
Handling Network Connections After Resume
On resume, the machine thinks its network connections are still live. External systems (databases, APIs) may disagree. Common symptoms:ECONNRESET- “Connection closed”
- Timeouts on first request
- Database pool errors
- Use connection pools with disconnect handling (see this excellent SQLAlchemy guide)
- Shorten connection timeouts to fail fast
- Use retry/backoff for HTTP clients
- Test after long suspensions
Billing
Suspended machines cost the same as stopped machines: storage only. There are no CPU/RAM charges. If a suspended machine has a volume, you continue paying for the volume for as long as it exists Volume storage is billed whether the machine is running, stopped, or suspended.Suspending a machine lowers your costs, but it does not free capacity in a region. Suspended machines still reserve their resources, so suspension is not a way to fit more machines into a capacity-constrained region
Monitoring & Debugging
runningsuspendingsuspendedstarting(resume or cold start)stopped
- Check requirements
- Confirm no migrations or deployments occurred
- Check logs for suspend/resume events
Availability
Suspend works in all Fly.io regions as of July 2024.Related reading: