Menu

Earn Premium with Referrals

Invite your friends and earn Premium rewards through our referral program.

See how it works and start inviting friends.

Active-Active
HLD

Active-Active

Every region serves traffic — the multi-region endgame and the consistency bill it brings.

The Topology

 [users EU]──►[region-EU]◄────┐
                              │ replication (all directions)
 [users US]──►[region-US]◄────┤

 [users APAC]─►[region-APAC]◄─┘

 ALL regions active: serve local traffic, replicate state
 continuously among themselves. no promotion dance —
 a region dying = traffic reroutes, done.

Why Teams Pay For It

 □ RTO ≈ SECONDS: no failover event at all; routing shift only
 □ LATENCY WINS: users served from nearby region —
   performance benefit paying for DR complexity daily
 □ NO IDLE STANDBY: all capacity does useful work
 □ REGIONAL MAINTENANCE: drain one region, others absorb;
   upgrades without capacity cliffs

The Consistency Bill

 two regions accept writes to the SAME record simultaneously:

 t=0  region-EU: set price = 10
 t=0  region-US: set price = 12     (both valid locally!)

 replication delivers both → conflict. now what?

 resolution strategies:
 LAST-WRITE-WINS:   timestamps decide; clock skew lies possible
                    simple; silent lost updates
 APPLICATION LOGIC: domain rules ("lowest price wins"? 
                    highest bid?) — must be deterministic everywhere
 CONFLICT-FREE TYPES (CRDTs): merges mathematically
                    (counters, sets); limited shapes
 AVOIDANCE:         partition data so only ONE region writes
                    each record (user-home-region model) ← 
                    the pragmatic dominant pattern!

 avoidance deserves emphasis: most systems don't need
 any-record-anywhere writes. route each user's WRITES home,
 replicate globally for reads. conflicts vanish by construction.

The Write-Routing Pattern (pragmatic AA)

 USER-HOME-REGION model:

 user profile:    home = EU → EU owns its writes
                  reads anywhere (local replicas)
 cross-region actions (transfer EU→US user):
                  saga/event through the bus; eventual per usual

 [EU]──owns: EU-users' writes──►replicate──►[US][APAC read-only]
 [US]──owns: US-users' writes──────────────►...

 benefits: zero write-conflicts + locality latency +
 true AA resilience. costs: cross-region interactions
 become async workflows (sagas lessons apply).

Requirements Checklist

RequirementConsequence if skipped
Deterministic conflict resolutiondivergent regional state
Idempotent replication applicationduplicate effects
Global uniqueness coordination (IDs)collisions across regions
Replication-lag-aware UXconfused users seeing old data
Per-region independence drillshidden shared dependencies
 global IDs matter early: UUIDs or region-prefixed keys
 from day one; retrofitting uniqueness across regions hurts.

Interview Framing

“Global social platform: design for region loss with no meaningful downtime” scored shape: active-active topology drawn, WRITE-HOME-REGION pattern chosen explicitly (conflict avoidance over resolution!), replication + lag-aware UX noted, global-ID/uniqueness checklist item named, RTO-statement (“routing shift, seconds”). Choosing avoidance-and-explaining-why beats heroically solving conflicts you engineered away — that’s the seniority signal here.

My Private Notes

Notes are auto-saved locally to this device.