SDSystem DesignConcepts to case studies
System DesignDSA
x
0/311
Part 1: Foundations
Part 2: APIs and Communication
Part 3: Caching
Part 4: Data and Storage
Part 5: Architecture
Part 6: Distributed Systems
Part 7: Advanced Data Topics
Part 8: Operations and Security
  • Deployment Strategies Overview
  • CI/CD Pipelines
  • Rolling Deployments
  • Blue-Green Deployments
  • Canary Releases
  • Feature Flags
  • A/B Testing Infrastructure
  • Schema Migrations
  • Rollbacks and Immutable Infrastructure
  • Multi-Region and Active-Active
  • Infrastructure as Code (Terraform)
  • Auto-Scaling Policies
  • Zero-Downtime Deployment
  • Chaos Engineering
  • Shadow Traffic and Dark Launches
Part 9: Estimation and Interview Method
Part 10: Case Studies
System Design/Operations and Security/Deployment Patterns

Multi-Region and Active-Active

Run the system in several regions at once, so users stay served when a whole region goes dark.

⏱ 14 min readAdvancedInterview FavouriteHas visualizer
SummaryConceptReal-Life ExampleWhy?Where?How It WorksStepsKey TermsPros & ConsMistakesReal WorldRead NextInterview Q&ACheat-Sheet

01Quick Summary

Multi-region means running your system in two or more cloud regions (far-apart groups of data centres). Active-active means every region serves live traffic at the same time. Active-passive means one region serves, and another waits as a backup.

  • Why: survive the loss of a whole region, give users a nearby server, and keep data in the country the law requires.
  • The price: more cost, more complexity, and the hardest part: keeping data in step across oceans.
  • The big choice: one region accepts writes (simple, some data loss on failover), or all regions accept writes (fast and resilient, but conflicts must be merged).

02Concept: What is it?

Inside one region, multiple availability zones protect you from a data centre failing. A whole region failing is rare, but it happens: a power or network fault, a bad configuration change, or a cloud service outage that spreads. A single-region system is down until the region returns. A multi-region system can carry on from somewhere else.

There are a few levels, often called disaster recovery tiers. They trade cost against how fast you recover.

TierWhat runs in the second regionRecovery speedCost
Backup and restoreOnly backups are copied overHoursLowest
Pilot lightData is copied live. Servers are off or tiny, ready to be grownTens of minutesLow
Warm standbyA smaller full copy runs all the time, no live trafficMinutesMedium
Active-activeFull copies serve real users in every regionSeconds (traffic just moves)Highest
Active-active: users go to the nearest healthy region
👥Usersworldwide
→↓nearest region
🌍Region Aapp + database
↕replicate
🌍Region Bapp + database
Users are sent by DNS or a global load balancer. Regions copy data to each other in both directions.
🧠The hard part is data
Stateless app servers are easy to run in many regions. The database is what makes multi-region hard, because light takes time to cross an ocean (roughly 70 to 200 ms round trip) and the CAP theorem still applies.

03Real-Life Example

🍵A Bank With Branches in Three Countries
A bank has its head office in one city and a small branch in another that keeps copies of the books. If the head office burns down, the branch takes over, but the last few hours of paper copies may not have arrived yet. That is active-passive. Now imagine every branch can open accounts and take deposits on its own, and they phone each other all day to share updates. Customers are served close to home and nothing stops if one branch closes, but two branches may update the same account at the same time, and someone must decide which update wins. That is active-active.
The bank
Multi-region system
A branch in another country
A second cloud region
Head office takes all deposits
Active-passive: one primary region takes writes
Every branch takes deposits
Active-active: every region takes writes
Phoning updates between branches
Cross-region replication
Last few hours of updates not yet sent
Replication lag, which sets your RPO
Two branches changing one account
A write conflict
Rules for which change wins
Conflict resolution (last-write-wins, merge, CRDT)
Fire drill: close one branch for a day
Region evacuation test

04Why Do We Need It?

🔥Survive a region outage
If a whole region fails, another one keeps the service up.
⚡Lower latency
Users talk to a region near them, instead of crossing the world for every click.
⚖️Data residency
Some laws or contracts say user data must stay in a country or area.
🛠️Safer maintenance
Drain one region, upgrade it, and bring it back with no user impact.
📈More capacity
Spread load over regions. A traffic spike in one place does not take down all.
🧯Smaller blast radius
A bad deploy or config can be limited to one region first.
Multi-region buys you resilience and speed, and you pay for it in money and in the difficulty of keeping data in sync. Use it when the cost of an outage is higher than the cost of the complexity.

05Where Do We Use It?

💳Payments
A region outage means lost sales. Often active-passive with strong consistency for money.
🎬Streaming and media
Content served from the nearest region, with data replicated widely.
💬Messaging and social
Users expect instant response everywhere. Active-active with eventual consistency.
🏥Regulated data
Health and finance data often stays in one country, with a separate stack per area.
🎮Online games
Players need low latency, so servers sit close to them in many regions.
🛒Global e-commerce
Catalog served everywhere. Orders may be routed to a home region per customer.

06Types / Parts / How It Works

The main patterns

PatternHow writes workFailoverMain trade-off
Active-passiveOne primary region takes all writes. Standby copies itPromote the standby (minutes)Simple, but standby is idle and async copies can lose data
Active-active, single writer per recordEach record has a home region that owns its writesMove ownership of that region's recordsNo conflicts, but far users pay latency for writes
Active-active, multi-writerAny region can write any recordTraffic simply reroutesFastest, but conflicts must be merged
Regional silosEach region is its own full system, with its own usersNot shared. Users stay in their regionGreat for residency, no global view
Routing and data are two separate problems
Routing
🧭DNS or global load balancerhealth checks, latency routing
📡Anycastsame IP announced from many places
Data
🔁Replicationsync or async
🧬Conflict handlingLWW, merge rules, CRDTs
Getting users to a healthy region is the easy half. Keeping the data correct is the hard half.

Choosing how to copy data

Copy methodBehaviourCost
Synchronous across regionsWrite is confirmed only after another region has it. RPO near zeroEvery write waits for an ocean round trip, and it blocks if the link breaks
AsynchronousWrite is confirmed locally, copied soon afterFast, but the lag window of writes can be lost on failover
Quorum across regionsA majority of regions must confirmSurvives one region loss, but writes pay cross-region latency
Conflict-free data types (CRDTs)Any region changes it, results always mergeOnly works for data shaped as a CRDT
Getting users there Keeping data right
VisualizerTake a region down and watch where users goSwitch between active-passive and active-active, then take down each region in turn. Watch the average latency, the data at risk (RPO) and the write conflicts change. Move the lag slider to see how it affects both.
Pattern
🇺🇸 US Eastup
primary: accepts writes
serving 100% of users
🇪🇺 Europeup
standby: receives copies
serving 0% of users
🌏 Asiaup
standby: receives copies
serving 0% of users
Users inServed fromRound trip
🇺🇸 US East (40%)US East10 ms
🇪🇺 Europe (35%)US East90 ms
🌏 Asia (25%)US East190 ms
Average latency
83 ms
weighted by users
Data at risk (RPO)
0 s
newest writes not yet copied
Write conflicts
0
per lag window, to merge
Users in the blip
0%
moved by the failure
Everyone talks to the primary in US East. Europe and Asia users pay extra latency (average 83 ms), but there is only one place to write, so there are no conflicts. The standby in Europe just receives copies. Now take US East down.

Illustrative numbers only: round-trip times, user shares and the conflict estimate are made up to show the shape of the trade-off. Real values depend on your regions, traffic and database.

07How to Use It / Steps / Implementation

Going multi-region step by step

  1. 1
    Decide what you need
    Write down the RTO and RPO per service, plus any data residency rules. Not every service needs the same tier.
  2. 2
    Make the app servers stateless
    Keep sessions and files in shared stores so any region can serve any request.
  3. 3
    Pick the data strategy
    One primary with async replicas, a home region per record, or multi-writer with conflict rules. This choice shapes everything else.
  4. 4
    Set up routing
    Use a global load balancer or DNS with health checks, plus a short TTL, so traffic can move quickly.
  5. 5
    Replicate everything the app needs
    Databases, object storage, queues, secrets, config, and container images. A forgotten dependency fails the failover.
  6. 6
    Keep regions independent
    Do not let region A call region B in the normal request path, or one failure spreads.
  7. 7
    Practise failover and failback
    Run game days where you drain a region on purpose. An untested failover plan is a guess.
  8. 8
    Watch for split brain
    Make sure a recovered old primary cannot accept writes while the new one is also writing. Use fencing.
💡Start small
Most teams go in stages: backups in another region, then a warm standby, then active-active only for the services that truly need it.
⚠️Capacity must fit the failure
If each of three regions runs at 80% and one fails, the other two must absorb the load. Keep enough spare capacity, or have a plan to scale up quickly.

08Key Terms to Know

TermMeaning in easy words
RegionA geographic area with several data centres
Active-passiveOne region serves, another waits as a backup
Active-activeSeveral regions serve live traffic at the same time
Pilot lightA minimal copy of the system kept ready to be scaled up
Warm standbyA smaller but running copy that can take over fast
Failover / failbackMoving traffic to another region / moving it back after repair
RPOHow much recent data you can afford to lose
RTOHow long you can afford to be down
Replication lagHow far behind a copy is, which sets the data-loss window
Conflict resolutionA rule for choosing or merging two writes to the same data
Data residencyA rule that data must stay in a certain country or area
Region evacuationDeliberately moving all traffic out of a region as a test

09Pros, Cons and Trade-offs

✅ Pros
  • Survives a whole region failing
  • Users get lower latency near home
  • Meets data residency rules
  • Safer upgrades, one region at a time
  • More total capacity
⚠️ Cons
  • Much higher cost
  • Data consistency is hard across oceans
  • Conflicts must be handled in active-active
  • More to test and operate
  • Failover paths are rarely used, so they rot unless practised

Trade-offs

ChoiceWe gainWe lose
Active-passiveSimple writes, no conflictsIdle money, slower failover, some data loss
Active-activeFast failover, local speedConflicts, complexity, more cost
Sync replicationAlmost no data lossSlow writes and tied availability
Async replicationFast writesA window of lost writes on failover
Short DNS TTLTraffic moves fastMore DNS queries, and some clients ignore it

10Common Problems and Mistakes

Common mistakes

  1. Never testing failover. The first real test is the outage, and something is always missing.
  2. Hidden single-region dependencies. A login service, a DNS provider, or a config store that lives in one region breaks everything.
  3. No spare capacity. The surviving region falls over under the extra load.
  4. Ignoring write conflicts. Last-write-wins quietly throws away user data.
  5. Cross-region calls in the request path. Latency adds up, and failures spread between regions.
  6. Split brain after failover. The old primary comes back and both accept writes.
  7. Forgetting failback. Getting back to normal is its own plan, with its own risks.

Things to watch

💸Data transfer cost
Moving data between regions is billed. Replication can be a large part of the bill.
🕰️Clock differences
Last-write-wins depends on clocks that disagree. Use logical or hybrid clocks.
🧱Shared control plane
A tool used to fail over must not live in the region that is failing.
📜Residency vs replication
Copying data to another region can break a law that required it to stay put.

11Real-World Examples

🎬Netflix
Has described running in several AWS regions and regularly evacuating one region to practise.
🌐Google Spanner
A globally distributed database that copies data across regions with strong consistency, paying cross-region latency on writes.
🛢️DynamoDB global tables
Multi-region, multi-writer tables with automatic replication and last-writer-wins conflict handling.
🪳CockroachDB
Lets you pin data to regions, which helps with residency and keeping reads local.
📦Cloud storage
Object stores offer cross-region replication so a bucket copy exists elsewhere.
🧪Game days
Many teams schedule drills where they cut off one region to see what breaks.
Mini case: region A fails
💥Region A failshealth checks fail
→↓DNS / GLB reroutes
🌍Region B takes over2x load, scaled up
→↓later
🔧Region A returnscatch up data, then failback
Health checks notice, traffic moves, and the surviving region carries the load.

12Related Topics to Read Next

Failover→

The switch to a backup, and active-passive vs active-active at small scale.

Global Load Balancing→

How users are routed to the best healthy region.

Backups, RPO, RTO and Disaster Recovery→

The goals and tiers that set how much multi-region you need.

CRDTs→

Data types that merge cleanly when many regions write.

Cloud Basics: Regions, Zones and Edge→

What a region and availability zone really are.

Split Brain Problem→

What can go wrong when two regions both think they lead.

Replication→

How copies of data are kept in step.

CAP Theorem→

Why you must choose between consistency and availability when regions cannot talk.

13Interview Questions with Short Answers

14Quick Revision Cheat-Sheet

  • ✔Why: survive region loss, lower latency, data residency.
  • ✔Tiers: backup, pilot light, warm standby, active-active (cheap and slow to fast and costly).
  • ✔Active-passive: one writer, simple, some data loss on failover.
  • ✔Active-active: all serve, fast failover, needs conflict handling.
  • ✔Routing: global load balancer or DNS plus health checks.
  • ✔Data: sync = slow writes, async = RPO window, CRDTs = clean merge.
  • ✔Always: spare capacity, no hidden single-region dependency, test failover and failback.
  • ✔One line: “Routing is easy, data is hard, and an untested failover is a hope.”
← Previous
Rollbacks and Immutable Infrastructure
Next →
Infrastructure as Code (Terraform)