System design concepts · Staying Up and Staying Safe

Multi-Region Architecture and Disaster Recovery (RPO, RTO)

One region is a single point of failure the size of a city. Going multi-region is how you survive losing one, and how you get close to users on the other side of the planet. It's also the most expensive complexity you'll ever buy, so buy it on purpose.

What you'll be able to explain
  • Explain why teams go multi-region, and why many shouldn't yet
  • Choose between active-passive, active-active and cell-based layouts
  • Route users to regions and fail them over safely
  • Handle data across regions: what to replicate, partition or keep global
  • Set RPO and RTO targets and pick a DR strategy that meets them

Why go multi-region?

Reason What you gain Is it worth it?
Survive a regional outage The service stays up when a whole cloud region fails Only if the business cost of hours of downtime beats the extra cost
Latency for global users Mumbai users hit Mumbai; Frankfurt users hit Frankfurt Often solved more cheaply with a CDN and edge caching
Data residency / law Indian payment data stays in India; EU data stays in the EU Mandatory when the law says so
Scale beyond one region Capacity limits of a single region Rare until you're very large
Tip

Most products should first get multi-AZ (several data centres in one region) right. AZs fail far more often than whole regions, cross-AZ latency is ~1–2 ms so synchronous replication is cheap, and every managed database supports it out of the box. Go multi-region when a regional outage would be an existential event, or the law requires it.

The three shapes

CLIENTUsersNETWORKGlobal DNS / LBhealth-checkedOKRegion A · MumbaiACTIVESERVICERegion B · HyderabadPASSIVE (warm)DATABASEPrimary DBDATABASEReplica DB100%0% (failover only)async replication
Active-passive: one region serves traffic; the other holds a warm, replicated copy ready to take over.
Shape How it works RTO Cost Complexity
Active-passive One region serves; the other is warm and receives replicated data Minutes ~1.5–2× Moderate: failover must be rehearsed
Active-active (read-local, write-home) All regions serve reads; each user's writes go to their home region Seconds to minutes ~2×+ Higher: routing by user
Active-active (multi-writer) Every region accepts writes for any data Near zero 2×+ Highest: conflict resolution
Cells Many independent, identical stacks; each user pinned to one cell Per cell Scales linearly Moderate once built; limits blast radius

Cells: shrinking the blast radius

A cell is a complete, independent copy of your stack (services, databases, caches) serving a slice of users. A thin router maps each user or tenant to a cell. A bad deploy or a poison request takes down one cell, say 5% of users, not everyone. Cells can live in different regions, and you grow by adding cells rather than making one giant cluster bigger. Large providers lean heavily on this pattern.

CLIENTUsersNETWORKCell routeruser → cell mapSERVICECell 1full stack + DBSERVICECell 2full stack + DBSERVICECell 3full stack + DBDATABASECell maptiny, replicated
Cell-based architecture: a thin router pins each customer to one self-contained cell.

Routing users to regions

Method How Failover speed Notes
GeoDNS / latency DNS DNS answers with the nearest healthy region Minutes (TTL, resolver caching) Cheap; clients may ignore TTLs
Anycast The same IP is announced from many locations; the network picks the nearest Seconds Used by CDNs and global load balancers
Global load balancer A provider's front end routes to healthy backends Seconds Simplest operationally
App-level routing The app knows each user's home region and redirects or proxies Immediate Needed when data is partitioned by region

Data: the genuinely hard part

Stateless services are easy to run everywhere. Data isn't. For each dataset, choose one of four strategies:

  1. Global and read-mostly (product catalogue, config): one write region, replicate everywhere asynchronously, serve reads locally. Staleness of seconds is fine.
  2. Partitioned by home region (user accounts, orders): each user's data lives in their home region. Reads and writes are local and strongly consistent. Cross-region access is rare and explicit.
  3. Synchronously replicated across regions (a global uniqueness constraint, a ledger that must never lose a write): consensus across regions (Spanner, CockroachDB, multi-region Aurora/DynamoDB options). Every write pays a cross-region round trip, 30–150 ms.
  4. Multi-writer with conflict resolution (shopping carts, collaborative docs, counters): accept writes anywhere, merge later with last-writer-wins, CRDTs or app-specific rules (CAP Theorem, PACELC and Consistency Models Explained).
Common trap

"We'll just make the database active-active." Multi-writer replication means two regions can accept conflicting writes to the same row, such as two withdrawals from the same balance. Last-writer-wins silently drops one of them. Money, inventory and uniqueness need a single writer (home region) or synchronous consensus.

Local primary (partitioned by home region)~2–5 msAsync replica elsewhere~2–5 ms to write; others see it 0.1–2 s laterSynchronous quorum across 3 regions~60–150 ms per writeMulti-writer + merge~2–5 ms, but conflicts must be resolved
Latency each strategy adds to a write (India ↔ Europe ≈ 120 ms round trip).