codequest / system design
Core concept 20 of 21

Multi-region architecture

Run in several parts of the world for lower latency and to survive a whole region going down.

Why more than one region

  • Latency: a round trip between Mumbai and Virginia takes about 200 ms over real networks, before any work happens. Serving users from a nearby region removes that.
  • Disaster recovery: whole cloud regions do go down. A second region keeps you running.
  • Data residency: some laws require users' data to stay in their country or region.

Patterns

PatternHow it worksTrade-off
Active-passiveOne region serves traffic; a standby region gets replicated data and takes over if the first failsSimple, but no latency benefit and some data loss on failover (async replication)
Active-active, read localEvery region serves reads from local replicas; writes go to one home regionFast reads everywhere; writes from far away are slow
Active-active, write localEvery region accepts writes and replicates to the othersFastest, but concurrent writes to the same data conflict and must be resolved
Partition by geographyEach user's data lives in their home region (EU users in the EU)Local and compliant; cross-region interactions need care

The pieces

  • Geo-DNS or anycast sends each user to the nearest healthy region.
  • A CDN already makes static content global; multi-region is about the dynamic part.
  • Cross-region replication is almost always asynchronous (synchronous would add a cross-continent round trip to every write), so expect lag. See CAP.
  • Conflict resolution for write-local setups: last-write-wins, merging (CRDTs), or routing each record's writes to one owner region.
  • Practise failover. A standby region nobody has tested usually doesn't work when it's needed.

In the interview

  • Only go multi-region if the requirements need it: global users with latency targets, strict uptime, or data laws.
  • Say which pattern and why, and be explicit that cross-region replication is asynchronous.
  • Mention how users are routed (geo-DNS) and how you'd fail over.