Fly.ioAnnouncement
Graceful VM exits, some dials
Summary
Fly.io introduces configurable VM shutdown behavior for applications whose clients, connections, or transactions need more than the default five-second termination window. After sending SIGINT, Fly normally waits five seconds before forcefully terminating a VM; the new kill_timeout setting extends that wait to as much as five minutes on Shared CPU VMs or 24 hours on dedicated CPU VMs, while kill_signal selects among several signals. The post demonstrates HAProxy’s soft-stop mode with SIGUSR1 to drain existing TCP connections and Postgres’s smart shutdown with SIGTERM to let open transactions commit before termination. It also describes infrastructure considerations: deploys and other releases can disrupt in-flight connections, so Fly drains connections where possible and offers ways to reduce reliance on shared HTTP and TLS handlers, plus stateless UDP and experimental stateless TCP load balancing.
Context
VMs are shut down for deploys, scaling, maintenance, and other reasons. The default SIGINT followed by a five-second wait works for many application servers but can terminate long-lived video sessions or database transactions before they finish.
Approach / What changed
Fly.io adds kill_timeout to control how long a VM remains alive after a shutdown signal, with limits of five minutes for Shared CPU VMs and 24 hours for dedicated CPU VMs. The kill_signal option allows SIGINT, SIGTERM, SIGQUIT, SIGUSR1, SIGUSR2, SIGKILL, or SIGSTOP, enabling application-specific graceful shutdown behavior.
Takeaways
The default VM shutdown sequence sends SIGINT, waits five seconds, and then forcefully terminates a still-running VM.
HAProxy can use SIGUSR1 for soft-stop behavior, stopping new connections while existing TCP connections drain.
Postgres can use SIGTERM with a five-minute timeout to commit open transactions through its smart shutdown mode.
Source and freshness
- Source
- fly.io
- Published
- Added to Yomu
- Last updated
Summaries are generated from the original by a language model. Check the original before relying on it.
Keep reading
Related reading
The Good Stuff
Paid picks we use ourselves. Links carry a referral code — a subscription through one earns us a commission at no extra cost to you.
The best engineering reads, once a week
One useful email. Unsubscribe anytime.