Until this month a rollback in Handoff was one rollback per region. Frankfurt went first, then Washington, and for about nine seconds a visitor in Singapore could load a page that Frankfurt had already withdrawn.
Nobody complained. We noticed it in our own logs, as a spike of mismatched assets that lasted exactly as long as a rollback. A page from the old deploy asked for a script from the new one, and got a 404.
One pointer, not five
Each region used to hold its own record of which deploy was live. A rollback walked the regions in order and rewrote each record, waiting for one to confirm before it started the next.
We moved that record into one place that every region reads, and let each region keep its answer for 200 milliseconds. A rollback is now a single write, and every region sees it within one window.
The fix was not to make five things faster. It was to stop having five things.
Keeping the old deploy warm
A pointer is only useful if what it points at is ready. Handoff now keeps the last forty deploys of a project on disk in every region, with the newest three already running, so a swap never waits for a start.
The cost is storage, and less of it than we feared. Most deploys share nearly all of their files with the one before, so forty of them take about three times the room of one.
What it looks like now
$ handoff rollback --to 1284
✓ Live on deploy 1284 in five regions
Finished in 0.8s
The slowest rollback we measured in testing took 1.1 seconds. The mismatched assets are gone from the logs, and handoff rollback no longer prints a line per region, because there is nothing left to wait for.
Priya Raman