Which failover topology meets RPO 60s, RTO 5m, and 50ms writes?
Question
Your checkout service runs in us-east, with disaster recovery in us-west. Cross-region round-trip latency (RTT) is 85 ms, and a local database commit takes 15 ms.
You must meet three hard targets at sensible cost:
- RPO
<= 60 s(max committed data lost) - RTO
<= 300 s(5 minutes max downtime) - Checkout write p95
<= 50 msduring normal operation
- Compare Backup & Restore, Pilot Light, Warm Standby, and Synchronous Active-Active against all three limits. Which topology wins?
- How do you prevent split-brain writes during failover, and how do you prove the 5-minute RTO holds?
Show hints (3)
- "CHECK RTT MATH"
Synchronous cross-region commits wait for at least one
85 msRTT plus15 mslocal work. Compare100 msagainst the50 mswrite SLA. - "COMPARE COLD BOOT TIMES"
Backup & Restore and Pilot Light both keep normal writes at
15 ms, yet restoring backups or cold-booting compute takes well over300 s. - "FENCE BEFORE PROMOTE"
Before
us-westtakes writes, revokeus-east's lease or epoch token so a partitioned old primary cannot keep accepting orders.
Show checked explanation
Choose Warm Standby with async cross-region replication (~10 s lag), a live scaled-down app fleet in us-west, and automated lease-fenced promotion (~120 s RTO). Normal writes stay at 15 ms (inside 50 ms). Backup & Restore misses RPO and RTO, Pilot Light misses the 300 s RTO, and Synchronous Active-Active hits 100 ms writes (2x the 50 ms limit).
MAX_RPO, MAX_RTO, MAX_WRITE_MS = 60, 300, 50 LOCAL_MS, RTT_MS = 15, 85 # (topology, rpo_s, rto_s, sync_cross_region) topologies = [ ("backup_restore", 300, 1800, False), ("pilot_light", 10, 720, False), ("warm_standby", 10, 120, False), ("sync_active_active", 0, 15, True), ] for name, rpo, rto, is_sync in topologies: write_ms = LOCAL_MS + (RTT_MS if is_sync else 0) ok = rpo <= MAX_RPO and rto <= MAX_RTO and write_ms <= MAX_WRITE_MS tag = "MEETS_ALL" if ok else "FAIL" print(f"{name:18} RPO={rpo:3d}s RTO={rto:4d}s" f" write={write_ms:3d}ms -> {tag}")
backup_restore RPO=300s RTO=1800s write= 15ms -> FAIL pilot_light RPO= 10s RTO= 720s write= 15ms -> FAIL warm_standby RPO= 10s RTO= 120s write= 15ms -> MEETS_ALL sync_active_active RPO= 0s RTO= 15s write=100ms -> FAIL
Author-checked on CPython 3.12.10: ran the DR topology constraint evaluator, checked RPO, RTO, and RTT latency margins, and simulated epoch fencing against split-brain writes. Checked by an editor other than the author.
Walkthrough
The physics of an 85 ms cross-region RTT plus a 300 s RTO narrows four textbook options down to one.
| Topology | RPO (<=60s) | RTO (<=300s) | Write p95 (<=50ms) | Relative cost |
|---|---|---|---|---|
| Backup & Restore | 300 s (fail) | 1,800 s (fail) | 15 ms | $ |
| Pilot Light | 10 s | 720 s (fail) | 15 ms | $$ |
| Warm Standby | 10 s (pass) | 120 s (pass) | 15 ms (pass) | $$$ |
| Sync Active-Active | 0 s | 15 s | 100 ms (fail) | $$$$ |
Why three options fail:
- Backup & Restore archives WAL every 5 minutes (
300 sRPO) and needs ~30 minutes (1,800 s) to provision, restore, and replay. - Pilot Light streams async WAL (
~10 slag, meeting RPO), yet app servers sit scaled to zero. Booting instances, warming connection pools, and shifting traffic takes ~12 minutes (720 s), missing300 s. - Synchronous Active-Active hits
0 sRPO and15 sRTO. Yet every write waits for an85 mscross-region RTT (15 + 85 = 100 ms), breaking the50 mswrite SLA by2xat the highest cost.
Why Warm Standby wins. Async streaming replication stays off the write path, keeping normal writes at 15 ms while holding typical lag to 5-15 s (50 s RPO margin at 10 s lag). A scaled-down app fleet and standby DB already run in us-west. Failover takes 120 s (30 s lease expiry + 45 s fencing and DB promotion + 45 s DNS/anycast shift and autoscaling), leaving 180 s of RTO headroom.
Preventing split-brain with fencing. A network partition can make us-east look dead while clients still reach it. Use a consensus-backed primary lease with a monotonic epoch number (epoch = 1 -> 2). Before us-west opens for writes at epoch = 2, wait for us-east's lease to expire and fence us-east (revoke write proxy routing and storage epoch). Any late write carrying epoch = 1 is rejected.
Proving RTO with drills. An untested failover plan breaks on stale DNS TTLs, missing IAM secrets, or cold caches. Run scheduled failover and failback game days on a realistic load, time every step against 300 s, and measure actual replication lag.
Common mistakes
- Picking Synchronous Active-Active for
0 sRPO without checking speed-of-light RTT. An85 mscross-region round trip makes a50 mswrite SLA impossible. - Promoting
us-weston a single failed health check without fencingus-east. Both regions then accept writes during a partition, causing split-brain orders that cannot merge cleanly. - Setting DNS TTL to
300 sor higher on the failover endpoint. Stale resolvers keep sending traffic to the dead region and blow the entire300 sRTO budget. - Never testing failback to
us-east. Reversing replication without wiping diverged local WAL from the crashed old primary can corrupt or drop new orders.
Follow-up questions
- "How do you handle the 10 seconds of locally committed writes not yet replicated to
us-westwhenus-eastdies?" Accept that async replication trades up to10 sof data loss for15 mswrites. Ifus-eaststorage later comes back, inspect its diverged WAL offline and reconcile unshipped payments against payment-processor records rather than re-attaching the old primary blindly. - "What if the business later demands
RPO = 0 sAND50 mswrites?" You cannot beat85 msRTT across distant regions. Move the sync quorum into three nearby availability zones (< 5 msRTT) inside one metro region, or partition customers by home region so each user's writes commit synchronously within nearby zones. - "Why do we need a third region or witness for automated failover?" With only two regions, neither side can tell whether the other died or the link between them snapped. A lightweight witness in a third region gives
2-of-3quorum so only the majority side can grant the new primary lease.
What a strong answer covers
Proves why Backup & Restore, Pilot Light, and Sync Active-Active (100 ms vs 50 ms) each fail a hard limit. Selects Warm Standby (10 s RPO, 120 s RTO, 15 ms writes), adds epoch fencing against split-brain, and requires timed failover drills.
Open in interactive practice deck →