Fly.ioProblem & solution
Throwing Out The Phonebook
Summary
Fly.io rebuilt 6PN, the private network between Fly Machines, by replacing a per-host eBPF phonebook of hundreds of thousands of migrated-Machine entries with a lazy-lookup design. The old system required every host to hold a real-time copy of every Machine’s location, leading to synchronization failures and undebuggable address translation. The new design uses VXLAN on top of WireGuard: when a host encounters an unknown 6PN address, VXLAN emits a netlink event, and s6pnforwarderd queries local Corrosion SQLite to write a single route. The routing table now holds 100–200 entries per host instead of hundreds of thousands. The first packet to a new destination incurs a lookup delay of under 100ms, but subsequent packets use the cached route. The rollout ran both systems in parallel, with asymmetric routing, until every host was upgraded.
Context
Fly.io operates 6PN, a private IPv6 network connecting Fly Machines. Each Machine’s address originally encoded its birth host, so migrated Machines required address translation. The old design used udp-xdp eBPF to rewrite addresses and maintained a per-host BPF map of every migrated Machine in the fleet, fed by a gossip-replicated SQLite subscription. That map grew to hundreds of thousands of entries, synchronization was unreliable, and debugging was impossible because addresses differed between sender and receiver.
Approach / What changed
Replaced a per-host eBPF map containing hundreds of thousands of migrated-Machine entries with a lazy-lookup system: VXLAN on top of WireGuard triggers a netlink event for unknown addresses, drift-agent handles host peers, and s6pnforwarderd queries local Corrosion SQLite to write a single route into the 0xfdaa routing table. The old udp-xdp translation and fleet-wide subscription were removed.
Takeaways
The old design required every host to hold a BPF map of every migrated Machine in the fleet, which grew to hundreds of thousands of entries and suffered from undetectable synchronization failures.
The new design uses VXLAN on top of WireGuard: unknown addresses trigger a netlink event, and a daemon queries local SQLite to write a single route, keeping the routing table at 100–200 entries per host.
The first packet to a new destination incurs a lookup delay of under 100ms; subsequent packets use the cached route. The rollout ran both systems in parallel with asymmetric routing until every host was upgraded.
FAQ
What is the latency cost of the lazy lookup on first contact?
The first packet to a Machine that the sender has never contacted triggers a lazy lookup, which typically completes in under 100ms. Linux's default TCP retransmission timeout is one second, so the first connection can take about a second. Subsequent connections use the cached route and go straight through.
What happens if the lookup daemon crashes?
If drift-agent or s6pnforwarderd crashes, existing routes continue to work. Only new conversations break: Machines that have never talked to each other, and Machines that just migrated. The second failure mode existed in the old design too; the first is new but considered the lesser evil compared to loading every route fleet-wide.
How did Fly.io migrate without a platform-wide maintenance window?
The rollout ran both systems simultaneously. A host on the new path sends outgoing 6PN traffic over VXLAN; if the destination host is still on the old system, replies come back over WireGuard via the old swapping code. The route was asymmetric but the kernel accepted it. The old map was kept up to date throughout, so old-style hosts continued working until every host was upgraded.
Source and freshness
- Source
- fly.io
- Published
- Added to Yomu
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.