Designing Global Multi-Datacenter Routing & Failover

A system design interview guide to sending every user to the right region, keeping data safe across regions, and surviving the total loss of a datacenter with little or no data loss and a fast recovery.

A service that runs in one datacenter is one power failure, fiber cut, or regional outage away from being down for everyone. Running in several regions fixes that, but it trades one hard problem for two: you must route each user to a healthy nearby region, and you must replicate state between regions so that losing one does not lose data. These two problems pull against each other through the laws of physics — the speed of light makes cross-region coordination slow, and the CAP and PACELC tradeoffs mean you cannot have strong consistency, low latency, and full availability at once. This guide works through both halves: the routing layer (GeoDNS, anycast, and GSLB), the choice between active-active and active-passive, synchronous versus asynchronous replication and what each does to your recovery objectives, and finally how to fail an entire region over without splitting the brain or losing writes.

Contents

  1. Requirements & Scope
  2. Back-of-the-Envelope
  3. RPO, RTO & Key Definitions
  4. High-Level Architecture
  5. Routing: GeoDNS, Anycast, GSLB
  6. Replication & Consistency
  7. Failover & Split-Brain
  8. Bottlenecks & Tradeoffs
  9. Summary

1. Requirements & Scope

The requirements split cleanly into the two halves — getting users to a region, and keeping data correct across regions — plus the disaster case that ties them together.

2. Back-of-the-Envelope

Two sets of numbers drive the design: the physics of cross-region latency, and the objectives that flow from the business.

QuantityAssumptionResult
Cross-region round tripUS east–west ~3,000 miles, fiber ~⅔ c~30–40 ms one way, ~60–80 ms RTT
Sync write penaltyevery write waits one cross-region RTT+~70 ms per write — on the hot path
Async replication lagship changes continuouslysub-second to seconds of exposure
DNS-based failoverrecord TTL 30–60s + resolver cachingminutes of stale routing worst case
Anycast reconvergenceBGP withdraws a failed POPseconds to reroute
Target RPO / RTOtier-1 serviceRPO ~0 (sync) or seconds (async); RTO ~minutes

The single most important number is the cross-region RTT: ~70 ms. Every design choice below is really a decision about whether to pay that latency on the write path (synchronous, zero data loss) or to avoid it and accept a small data-loss window (asynchronous). Physics, not preference, forces the trade.

3. RPO, RTO & Key Definitions

The vocabulary of disaster recovery is precise, and interviewers expect it. Two numbers frame every failover design.

TermMeaningDriven by
RPO (Recovery Point Objective)How much recent data you can afford to lose — the age of the last safe copy.Replication mode (sync → 0, async → lag).
RTO (Recovery Time Objective)How long you can be down — time to detect, promote, and reroute.Failover automation and routing TTLs.
Active-activeAll regions serve live traffic simultaneously.Multi-master or partitioned ownership.
Active-passiveOne region serves; others stand by, ready to promote.Single primary + hot standbys.
Split brainTwo regions both act as writable primary and diverge.Prevented by quorum / fencing.
QuorumA majority must agree before acting, so only one side can win.Consensus (Raft / Paxos).

The mental model: RPO is a data question answered by replication, and RTO is a time question answered by automation and routing. Sync replication buys RPO = 0 at a latency cost; fast, well-drilled failover buys a low RTO.

4. High-Level Architecture

The shape is a global routing layer on top of two or more self-sufficient regions, with a replication channel between their data stores.

Global routing layer directing users to two regions, each with load balancer, stateless app tier, and a database, with replication between the databases
Users hit a global routing layer (GeoDNS, anycast, or GSLB) that steers them to the nearest healthy region. Each region runs a full stack — load balancer, stateless app tier, database — and the data stores replicate across regions, synchronously or asynchronously.

5. Routing: GeoDNS, Anycast, GSLB

There are three common ways to get a user to a region, and mature systems layer them. Each makes a different tradeoff between control, speed of failover, and connection stability.

In practice you combine them: anycast to reach the nearest edge/POP fast, GSLB (health-aware DNS) to choose the healthy origin region, and short DNS TTLs so a policy change propagates quickly. Whatever the mechanism, the routing layer must be driven by real health signals, because routing to a region that is failing is worse than routing nowhere.

6. Replication & Consistency

How data moves between regions is the heart of the design, because it fixes both your data-loss bound and your write latency. The choice is synchronous versus asynchronous, and it is a direct expression of the PACELC tradeoff: even when the network is fine, you choose between latency and consistency.

Synchronous replication waits for the replica to acknowledge before commit; asynchronous acknowledges the client first and replicates later
Synchronous replication commits only after the remote replica acknowledges — RPO = 0, but every write pays a cross-region round trip. Asynchronous acknowledges the client immediately and ships changes in the background — low latency, but a lag window of writes can be lost if the primary dies.

Active-active adds a wrinkle: if more than one region accepts writes, concurrent writes to the same key can conflict. You resolve that either by partitioning ownership (each key’s writes are homed to one region, so there is no conflict), or by using a store with principled conflict resolution (CRDTs, last-writer-wins with care). The simplest correct answer in an interview is usually a single write region per data partition with async read replicas elsewhere — it sidesteps conflict entirely.

7. Failover & Split-Brain

Failover is the moment the design is really tested: a region is gone, and you must promote another to primary without losing data and without ever letting two regions both write. The dangerous failure is not the outage — it is the split brain, where the old primary is not actually dead (just partitioned) and keeps accepting writes while the new one does too, producing two divergent histories that cannot be merged.

Failover sequence: detect, fence old primary, confirm replica caught up, promote replica, repoint routing, drain and verify, fail back later
A disciplined failover: detect the failure, fence the old primary so it cannot write, confirm the replica is caught up, promote it, repoint routing, drain and verify against RPO/RTO, and resync the old region later.

The safeguards that make this correct:

function failover(region):
  if not quorum.agrees(region.is_dead):
    abort()                              # avoid false failover
  fence(region.primary)                  # revoke lease / bump epoch
  candidate = most_caught_up_replica()   # least data loss
  loss = primary.log_pos - candidate.log_pos
  record_rpo(loss)                       # async: this is the data-loss window
  promote(candidate)                     # new primary, new epoch
  routing.repoint(candidate.region)      # GSLB / DNS / anycast
  drain_and_verify()                     # check RTO met
Interview tip. When asked to “survive a regional failure without data loss,” connect the two objectives explicitly: zero data loss (RPO 0) requires synchronous or quorum replication, which costs you a cross-region round trip on every write. Then say what you would actually do — often sync (or quorum) within a latency-tolerant region group for the critical data, async for the rest — and always name fencing plus quorum as the split-brain defense. Stating the cost of RPO 0 out loud is what separates a senior answer from a hand-wave.

8. Bottlenecks & Tradeoffs

The tensions here are fundamental — they come from the network and from CAP/PACELC, not from implementation.

9. Summary

Global multi-region design is two problems bound by the speed of light: route users to a healthy region, and replicate data so losing a region does not lose the data. Every choice is a placement of the same latency-versus-durability trade.

ConcernMechanism
How do users reach a region?GeoDNS for proximity, anycast for fast reroute, GSLB for health-aware steering — layered.
How much data can we lose?RPO — set by replication: sync/quorum → 0, async → the lag window.
How long can we be down?RTO — set by detection, automated promotion, and routing TTLs.
All regions live or standby?Active-active for latency and utilization; active-passive for simplicity and lower cost.
How do we replicate correctly?Sync/quorum for RPO 0 at a latency cost; async for speed; partition write ownership to avoid conflicts.
How do we avoid two primaries?Quorum-based promotion plus fencing of the old primary — the cure for split brain.
How do we know it works?Regular DR drills / game days that actually evacuate a region and measure RPO and RTO.
The recurring theme: you cannot beat physics, so you place its cost deliberately. Decide per data type whether zero data loss is worth a cross-region round trip, route on real health rather than geography alone, and make failover safe with quorum and fencing — then prove it in drills before the real outage proves it for you.