Module A-9·32 min read

Active-passive vs active-active, geo-routing, data residency — and ordering concurrent cross-region writes without trusting a wall clock, where last-write-wins is silent data loss.

JJS
Written by Jatin Jain Saraf · Senior Software Engineer

Module A-9 — Multi-Region Architecture

What this module covers: The three genuinely different reasons to go multi-region — user latency, surviving a regional failure, and data-residency law — each of which demands a different architecture, so conflating them is the primary design error. The physics that constrains everything: a round trip you cannot shorten. Six topologies in ascending order of cost and complexity, with the observation that the fourth — active-active over partitioned data — is where most systems should stop, because it removes conflicts by construction. Routing, and why DNS-based failover disappoints. Then the write path, which is the entire problem: last-write-wins as silent data loss stated plainly, conflict detection with version vectors, CRDTs and the constraints they provably cannot express, and the escrow pattern that lets you make local decisions about a global budget. Data residency and the observability pipeline that quietly violates it. Failover and the two-region problem that makes safe automatic failover impossible without a third site. And the cross-region egress bill, which is the most under-estimated line item in this course.


Three Reasons, Three Architectures — Do Not Conflate Them

"We need to be multi-region" is three different requirements wearing one sentence, and they lead to different designs:

ReasonWhat it actually demandsWhat it does not require
User latency — users in Sydney wait 250 ms per round tripdata close to readers: edge caching, regional read replicaslocal writes, or conflict resolution
Regional failure survival — a whole region becomes unavailablea complete, tested stack elsewhere with defined RPO/RTOserving traffic from both simultaneously
Data residency — EU personal data must stay in the EUpartitioning by jurisdiction, including backups and logsglobal replication (which may be illegal)

A team that wants the first and builds the fifth topology below has taken on conflict resolution to solve a caching problem. A team that wants the second and builds regional read replicas has bought latency improvements and no disaster recovery — the replicas cannot serve writes.

And one honest note before the rest: "high availability" alone rarely justifies multi-region. Multi-AZ within one region gives you independent power, cooling and network across physically separate facilities, with single-digit-millisecond latency between them — which means synchronous replication is viable and there is no conflict problem at all. Whole regions do fail, and rarely. If your availability target is achievable multi-AZ, achieve it there; the honest drivers for crossing a region boundary are usually latency and law.

Analogy: opening a second warehouse. If the reason is "customers in Scotland wait three days for delivery," you want stock positioned closer to them — a distribution point, restocked from the main site. If the reason is "a fire would end the business," you want a complete duplicate that could take over, which is a different building with different contents and a rehearsed plan. If the reason is "goods for the EU may not be stored in the UK," you want two legally separate inventories that must never be pooled. Three different buildings, three different stock policies, and a plan that tries to be all three is worse at each.


The Physics You Cannot Engineer Around

Light in fibre travels about 200 km per millisecond, and real routes are roughly twice the great-circle distance. So:

RouteRound trip (typical)
Within an AZ< 1 ms
Between AZs in a region1–2 ms
London ↔ Frankfurt~ 15 ms
London ↔ N. Virginia~ 75 ms
London ↔ Singapore~ 180 ms
London ↔ Sydney~ 250 ms

These numbers are not going to improve. Which yields the constraint that the rest of the module is a response to:

Any synchronous cross-region operation costs at least one of those round trips, and a consensus write costs one to a quorum (Module A-1).

So a globally-consistent write is 100 ms or more, per write, forever. A page that makes three sequential cross-region calls is at 750 ms before it has done any work. This is why the interesting architectural moves are all about avoiding cross-region round trips on the critical path rather than making them faster — and it is Module F-2's mechanical-sympathy argument at planetary scale.


Six Topologies, in Order of What They Cost You

1. One region plus a CDN and edge caching. Static assets and cacheable responses served from hundreds of edge locations; everything dynamic goes to one region (Modules F-15, F-10).

This is the correct first answer for the large majority of products, and it is frequently skipped in favour of something far more expensive. Most perceived slowness for distant users is assets, TLS handshakes and round trips for cacheable content — all of which the edge fixes with no consistency problem whatsoever. Measure what fraction of your page time is actually the dynamic call before building anything below this line.

2. Regional read replicas. Reads served locally, writes routed to the home region.

Gains: local read latency. Costs: replica lag, so read-your-own-writes breaks (Module P-11) — a user in Sydney writes to London and immediately reads a stale local replica. The mitigations are the ones from that module: route a session to the primary for a short window after its write, or carry a position token. Write latency is unchanged, which is the honest limitation.

3. Active-passive (warm standby) for disaster recovery. A full stack in region B, receiving asynchronous replication, promoted if A fails.

Gains: a genuine survival story with a stated RPO and RTO (Module O-7). Costs: you pay for capacity that serves nothing, and — the real failure — failover is rarely exercised, so it does not work when needed. An untested standby is a line item, not a plan.

4. Active-active over partitioned data. Each region is the single writer for a subset of the data: users have a home region, and their writes always go there.

text

This is where most systems should stop. There are no write conflicts, because no two regions ever write the same record — which is Module A-2's "design the lock away" applied at continental scale. Both regions serve traffic, both are warm (so failover is real rather than theoretical), and writes are local for the users who matter.

Its requirements and costs are specific: the partition key must align with users (a natural fit for B2B tenants and most consumer products, poor for globally-shared data like a single marketplace inventory); cross-partition operations need a distributed transaction or a saga (Module A-3); a user who moves regions needs a migration procedure; and failover means one region temporarily writing another's partition, which needs a fence (Module A-2) to prevent the recovering region from continuing to write.

5. Active-active with full replication and conflict resolution. Any region writes anything.

Gains: minimum write latency everywhere, maximum availability. Costs: conflicts are guaranteed, and the rest of this module is about them. Choose this only when the requirement is genuinely "every user writes every record from anywhere," which is rarer than it sounds.

6. Globally consistent (Spanner, CockroachDB). Consensus across regions per write.

Gains: strong consistency, no conflicts, SQL, no application-level merge logic. Costs: the physics — every write pays a cross-region quorum round trip, so 100 ms+ commit latency unless data is pinned to a locality (which both systems support, and which turns this back into topology 4 with better tooling).

Read latencyWrite latencyConflictsComplexityIdle cost
1. CDN + one regionlow (cached)one regionnonelownone
2. Regional replicaslowone regionnonelowreplicas
3. Active-passiveone regionone regionnonemediumfull standby
4. Partitioned active-activelowlownonemedium-highnone (both serve)
5. Full active-activelowlowguaranteedhighnone
6. Global consensuslowhighnonemediumquorum everywhere

Routing: Getting the User to the Right Region

GeoDNS resolves a name differently by the resolver's location. Simple, works everywhere, and inherits every DNS problem from Module A-5: caching beyond TTL, resolver location differing from user location, and — decisively for failover — a connection pool that never re-resolves, so existing clients keep talking to a dead region.

Anycast with BGP advertises the same IP from many locations and lets the network route to the nearest. This is how CDNs work, and its advantage for failover is large: withdrawing a route reconverges in seconds without depending on any client's DNS cache.

A global load balancer (health-checked, provider-managed) sits between the two: one anycast entry point, health-aware backend selection, and failover that does not wait on TTLs. For most teams this is the right mechanism.

And region pinning at the application layer, which is required for topology 4 and often forgotten: the user's home region is a property of the user, not of their current location. Carry it in the session token or a cookie, so a user travelling to Tokyo still has their writes routed to their home region rather than being geo-routed into a region that does not own their data. Geographic routing decides where you enter; the home region decides where you write.

Sign in to keep reading

The rest of this module is free — sign in with Google to unlock it and track your progress.

Sign in & Register

Discussion

0

Join the discussion

Loading comments...

© 2026 Jatin Jain Saraf (JJS). All rights reserved.