Multi-Region and Geo-Distributed Systems Questions
Running a system across regions and continents: multi-region replication, data residency and sovereignty, geo-routing and CDN edge distribution, cross-region consistency and quorum placement, and conflict resolution when two regions accept writes. Covers regional failover and split-brain prevention, recovery objectives (RTO/RPO), region-by-region rollout and blast-radius containment, and the latency, cost, and consistency tradeoffs of going global. Global distribution strategy across the service and data tiers.
For a collaborative document editing feature where edits are made in different regions and sometimes offline, propose conflict detection and resolution approaches. Compare OT (operational transform), CRDTs, and last-write-wins for correctness, complexity, storage and developer ergonomics.
Sample Answer
Direct answer
For the core text-editing path, choose between operational transformation (OT) and CRDTs (Conflict-free Replicated Data Types, data structures designed so two divergent copies can always be merged automatically without a central coordinator), both can correctly merge concurrent, even offline, edits, but they make different trade-offs between server dependence, storage, and implementation risk. Last-writer-wins (LWW), where the most recent write simply overwrites an earlier one, is not appropriate for concurrent body-text edits since it would silently discard one person's work, but it is fine for single-writer metadata like a document's title.
The three approaches
- Operational transformation (OT). Each incoming remote edit is transformed against whatever concurrent edits happened locally, so it can be applied correctly on top of a state that has since diverged. For example, if you inserted a character at position 5 while someone else concurrently deleted a character at position 2, OT rewrites your insert's target position to account for the shift caused by their delete, keeping both edits' intent intact. This is how early Google Docs-style collaborative editors worked.
- CRDTs for text (commonly a sequence CRDT such as an RGA, replicated growable array). Every character gets a stable, unique, immutable position identifier when it's inserted, so two replicas can merge their edit histories in any order, or after being offline for a while, and always converge to the same document without needing a central server to referee the merge.
- Last-writer-wins. For document editing specifically, LWW applied to the body text would let one person's entire concurrent edit simply overwrite the other's, an unacceptable loss of work; it only makes sense for metadata fields with a single natural owner, like "last editor" or the document title.
Comparison
| Dimension | Operational transformation | CRDTs | Last-writer-wins |
|---|---|---|---|
| Correctness under concurrency and offline editing | Correct, but historically depends on a central server to serialize and transform operations in the right order, making true peer-to-peer or offline-first editing harder | Correct and naturally peer-to-peer and offline-tolerant; any two replicas merge regardless of arrival order or connectivity | Not correct for concurrent body-text edits; one side's work is simply discarded |
| Complexity to implement | High: transform functions must be proven correct for every pair of concurrent operation types, a notoriously easy place to introduce subtle bugs | Moderate today, since mature, well-tested text CRDT implementations exist, though reasoning about the failure edges still takes real effort | Low: just compare timestamps |
| Storage overhead | Low: mainly the operation log itself | Higher: each character or element typically needs a stable unique identifier, and deletions often leave tombstones, so in-memory document size can be a multiple of the visible text | Low: a single value plus a timestamp |
| Developer ergonomics | Mature libraries exist from the earlier era of collaborative editors, but designing a new transform function for a novel data model is close to a research problem | Better for offline-first apps specifically, since no central sequencer is required for correctness | Trivial to build, but wrong for this use case |
Worked example
Two people edit the same paragraph while briefly offline from each other, one inserts a word near the start, the other deletes a sentence later in the same paragraph. A text CRDT assigns each character a stable position identifier at insert time, so when the two edit histories merge, both changes apply correctly without either needing to know about the other's edit in advance, insertions and deletions from both sides land in the right place relative to each other. The same scenario under OT routes both operations through a central server (or a peer acting as one), which transforms whichever arrives second against the one that arrived first. That part works even though both authors were offline at the same time: on reconnect each client sends its operations tagged with the server revision it last saw, and the server transforms them forward, which is exactly how offline mode in a server-backed editor is built. What OT does not give you is the same guarantee with no server in the picture at all, because peer-to-peer OT requires the transform function to satisfy a much stronger pairwise property (any two operations must transform to the same result no matter which order the peers apply them in), and that property is hard to prove and easy to get subtly wrong. The CRDT's advantage is therefore narrower than "it handles offline": both handle offline, and the CRDT is what handles offline without a sequencer.
Trade-offs and pitfalls
The most relevant trade-off for an offline-first or peer-to-peer product is that CRDTs handle the offline case naturally while classic OT generally assumes a central server is available to serialize operations; the cost is CRDTs' larger memory footprint from per-character metadata and tombstones, which needs its own garbage-collection strategy over time so it doesn't grow unbounded.
Compare synchronous and asynchronous replication across geographic regions. For each approach, explain impacts on write latency, recovery point objective (RPO), durability, failover behavior, and operational complexity. Provide concrete scenarios where synchronous replication is appropriate and scenarios where asynchronous replication is preferable.
Sample Answer
Direct answer
Synchronous cross-region replication makes the primary wait for a remote replica to confirm it received (and usually applied) a write before the primary tells the client "committed." That buys a recovery point objective (RPO, the maximum data you can afford to lose on failure) of zero, at the cost of adding a full wide-area-network (WAN) round trip to every write's latency. Asynchronous replication lets the primary commit locally and ship the change to remote regions in the background, so writes stay fast but a region failure can lose whatever hadn't shipped yet.
Structured elaboration
| Dimension | Synchronous | Asynchronous |
|---|---|---|
| Write latency | Local commit time plus one WAN round trip to the remote region (often 60-150ms extra depending on distance) | Local commit time only; replication happens off the critical path |
| RPO | Zero, by construction, for whichever replicas are in the sync set | Equal to however far replication lag has drifted at the moment of failure (seconds to minutes under load) |
| Durability | Data survives the loss of the primary's entire region, not just a disk or host | Data written in the last replication interval can be permanently lost if the primary region is destroyed before it ships |
| Failover behavior | The synced replica is guaranteed current, so promoting it is safe immediately | The replica may be behind; promoting it means accepting the lag as lost data, or pausing to reconcile |
| Operational complexity | Must handle "what happens when the sync replica is unreachable" (block writes, or degrade, see semi-sync configs) | Simpler steady state, but needs lag monitoring, alerting, and a documented loss-tolerance story |
Worked example
A financial ledger service that posts account balance changes cannot tolerate silently losing a committed debit or credit if a region disappears: two customers' balances must always sum correctly. That system should pay the WAN round trip and replicate synchronously to at least one other region, accepting slower writes in exchange for zero data loss on failover.
Contrast that with an image hosting or content-delivery style service that stores user-uploaded photos and their metadata. If a region fails a few seconds after an upload and that specific upload's replication hadn't finished, the practical cost is "ask the user to re-upload one photo," not a financial discrepancy. That workload should use asynchronous replication: writes stay fast for users worldwide, and the rare lost object during an already-rare regional failure is an acceptable, bounded cost.
At least two concrete trade-offs fall out of this: (1) synchronous buys correctness but couples your write latency and your write availability to a remote region's health, since an unreachable replica can block writes entirely unless you build in a fallback; (2) asynchronous buys latency and availability but means your real RPO is "whatever your monitored replication lag happens to be," not zero, so you must actually measure and alert on lag rather than assume it stays small.
Trade-offs and pitfalls
A common wrong turn is picking asynchronous replication for a "we'll be fine" workload without ever measuring lag under real production load: lag that is 200ms in a demo can become tens of seconds during a traffic spike or a slow disk on the replica, which quietly worsens your real RPO far past what anyone signed off on. On the synchronous side, the pitfall is treating "synchronous" as free correctness: if the sync replica becomes unreachable, a naive implementation will hang every write in the whole system, turning a single remote replica's network blip into a full outage. Most real systems land on a middle ground (semi-synchronous, waiting for just one of several replicas) rather than either extreme.
Design a data ownership and governance model for a federated global platform: each region runs independent microservices but central data governance is required for security, schema evolution, and access control. Describe metadata catalogs, API contracts, versioning policies, and how to enforce global policies while preserving regional autonomy.
Sample Answer
Direct answer
Separate what must be centrally enforced, a deliberately short list like security policy, schema and API compatibility rules, and access control, from what regions own, their own deployment cadence, storage choices, and scaling decisions. Enforce the central list through shared infrastructure regions can't opt out of, not through a policy document they're expected to remember.
Framework
- Metadata catalog: a central, searchable registry of what data each region's services own, its schema, its sensitivity classification, and who's accountable for it, so a compliance review can answer "who has data like this" without emailing every region's team.
- API contracts and schema evolution: every service other regions depend on publishes a versioned contract and is required to make only backward-compatible changes without a coordinated migration. A compatibility check runs automatically at build or deploy time and blocks a breaking change from shipping, rather than relying on a team remembering the rule.
- Access control: enforce the global policy, for example no service may read another region's raw personal data without an explicit, logged grant, at a shared gateway or service-mesh layer every region's traffic passes through, so a regional team physically cannot bypass it even if they wanted to.
- Versioning policy: track schema and API versions in the catalog with deprecation timelines, so a region can evolve its own service on its own schedule as long as it honors the compatibility window it advertised to consumers.
- Preserving regional autonomy: regions choose their own storage engine, scaling strategy, and release cadence for anything not on the centrally-enforced list. The central platform team's job is maintaining the shared enforcement infrastructure, the catalog, the compatibility checker, the policy gateway, not reviewing every regional decision.
Worked example
One region's order service wants to add a new required field to its event schema. The registry
check is a pure schema-versus-schema comparison against the previously registered version, judged
under the compatibility mode configured for that stream, and under the common backward-compatible
setting a field added with no default fails outright: a consumer running the new schema could not
read the events already written under the old one. The registry has no idea who the consumers are,
and that is the point, the gate is mechanical and there is nobody to argue with. The team adds the
field as optional with a default instead, which passes, and only then uses the catalog to find
which regions actually consume that stream and to track them onto the new version before tightening
the field in a later release. Note the division of labor: the automated check blocks the unsafe
change with no central review, while the catalog turns the follow-up coordination into a short list
of named owners rather than a broadcast email to every region.
Trade-offs and pitfalls
Making the centrally-enforced list too large turns the platform team into a bottleneck for every regional decision, defeating the autonomy goal. Making it too small, or enforcing it by policy document instead of infrastructure, is how compliance and compatibility violations quietly accumulate region by region until an audit finds them.
Design a global pub/sub messaging service that guarantees per-key ordering and supports multi-region replication with low tail latency. Discuss partitioning, leader-election for partitions, synchronous vs asynchronous replication, handling failover, and trade-offs between ordering guarantees and availability.
Sample Answer
Direct answer
Assign each message key to exactly one partition with a single elected leader in one home region
that owns the ordering decision for that key, replicate the partition's log to the other regions as
followers, and get per-key ordering from "everyone reads the same log in the same order," not from
any cross-region locking on publish.
Structured elaboration
Partitioning. Hash each message key to a fixed partition, so a given key always lands in the
same partition and its relative order is simply the log order within that partition, the same
partitioned-log shape used by systems like Kafka.
Leader election for partitions. Each partition has one leader region at a time, elected via a
consensus protocol such as Raft (a leader-election and log-replication algorithm that keeps a
cluster's members agreeing on one authoritative log even when some members are unreachable). Only
the leader accepts publishes for that partition, so there is never a second, conflicting order
being decided elsewhere.
Synchronous vs. asynchronous replication. Replicate the leader's log synchronously to a quorum
(a required majority) of follower regions if a publish must only be acknowledged once it can
survive a failure, and to the remaining, farther followers asynchronously for read scaling and
disaster recovery, since waiting on every follower globally would tie publish latency to the single
slowest region.
Handling failover. If a partition's leader region becomes unreachable, the remaining regions run
leader election, and the election rule is what decides whether acknowledged messages survive. Under
a majority-quorum protocol such as Raft, a message is only acknowledged once a majority holds it,
and a candidate can only win an election if its log is at least as up to date as the majority that
votes for it. Any two majorities of the same group share at least one member, so every acknowledged
message sits on at least one voter and the winner's log must already contain it. Concretely: with a
2-of-3 synchronous quorum, a single region failure loses zero acknowledged messages. A majority is
sufficient, and demanding an acknowledgment from every follower buys no extra safety against that
failure; it only ties publish latency to the worst region and makes the partition unwritable the
moment any single follower is down. What does lose acknowledged messages is acknowledging before
the quorum holds the message: if the leader replies to the publisher on its own local write and
replicates asynchronously, everything in flight when it dies is gone. So the question is not "how
many followers" but "before or after the quorum," and only the second is safe.
Ordering vs. availability trade-off. Once the synchronous set is a majority, acknowledged
messages survive any single region failure outright, so growing it past a majority does not buy
more durability against that failure. What it buys is tolerance of more simultaneous failures: a
five-region group with a three-region synchronous quorum survives two regions at once, where a
three-region group survives one. The cost is paid twice over, since publish latency rises to the
slowest member of the larger synchronous set and the set of regions that must be healthy for
publishes to succeed grows with it. At the other end, a synchronous quorum of just the leader gives
the fastest publishes but means a single leader failure can lose the last acknowledged messages,
which is the asynchronous-acknowledgment case above.
Worked example
Three regions per partition, synchronous quorum of 2 of 3 (leader plus one follower). Publish
latency is the leader's local write plus the round trip to whichever follower is closer: about 15ms
for a same-continent follower versus about 75ms across an ocean. Check any transoceanic figure
against the distance before using it: us-east to eu-west is 5,466 km great-circle, which over a
realistic 1.4x cable path at the speed of light in fiber (about 204,000 km/s) is a 74.9ms
round-trip floor, and even a physically impossible perfectly straight fiber run on that pair could
not go below 53.5ms, so a quoted transatlantic round trip near 40ms is below physics rather than
merely optimistic. Picking the same-continent follower
as the sync partner keeps typical publish latency around 15-20ms while the async third follower
catches up over the next replication round. Requiring all 3 regions to acknowledge synchronously
instead would bind publish latency to the slowest round trip, say 180ms to a genuinely distant third
region, a roughly 9-12x latency cost paid on every publish to guard against a failure mode the 2-of-3
quorum already covers for anything short of a simultaneous double-region failure.
Trade-offs & pitfalls
Consumers must be told explicitly that ordering is guaranteed only within a key or partition, never
globally across keys, or they will build logic assuming a total order that doesn't exist. Picking
synchronous replicas purely by geographic closeness, without considering shared failure domains
(for example two regions on the same undersea cable), can make a "2 of 3" quorum fail together more
often than the math implies.
flowchart LR
Pub[Publisher] --> L[Partition leader region A]
L -->|sync ack| F1[Follower region B]
L -.async.-> F2[Follower region C]
L --> Log[(Partition log, ordered)]
F1 --> Log
F2 --> Log
L -->|leader fails| Elect[Leader election among in-sync followers]
Elect --> F1
Propose an architecture for a global write-heavy workload that balances low-latency writes and durability: consider regional primaries with asynchronous cross-region replication plus selective write-forwarding and conflict avoidance via sharding. Provide failure modes, mitigations, and SRE operational cost estimates (bandwidth, runbook complexity, on-call load).
Sample Answer
Direct answer
For a global write-heavy workload, give each region its own primary that owns a disjoint slice of the keyspace (sharding by geography or by a hash), so most writes land locally and fast, and forward the rare write for a key another region owns rather than accepting it locally. Because ownership is exclusive, true concurrent write-write conflicts on the same key shouldn't occur under correct routing, avoiding the constant merge overhead a true multi-master design would carry, at the cost of needing a reliable ownership map and a forwarding path.
Structured elaboration
- Regional primaries with asynchronous cross-region replication: each region's primary replicates its shard asynchronously to the other regions, purely so those regions can serve fast local reads of data they don't own; it is not a write path.
- Selective write-forwarding: when a client in region B needs to write a key owned by region A, region B's application layer forwards that specific write to region A's primary rather than writing locally, using an authoritative ownership map (not a guess) to decide where to send it.
- Conflict avoidance via sharding: because a key has exactly one owning region at any time, the system avoids needing vector clocks, last-write-wins, or merge logic for the common case; the hard part shifts to keeping the ownership map correct and consistent everywhere.
Failure modes and mitigations
- A stale or buggy ownership map causes a write to land in the wrong region's local store. Mitigate by having every primary reject (not silently accept) any write for a key it doesn't authoritatively own, and alert loudly, since an accepted misrouted write is a correctness bug, not a normal event.
- The forward path fails because the owning region is unreachable when a non-owning region tries to forward a write. Mitigate with a bounded retry and a circuit breaker (a mechanism that stops sending an operation to a target it has detected is failing, so callers fail fast instead of piling up retries against something already down; for example, retry for up to 5 seconds, then surface an explicit "try again shortly" response to the caller rather than queueing indefinitely or silently dropping the write).
- Replication lag causes a stale read in a non-owning region right after a write. Mitigate with read-your-writes stickiness: route the writing user's subsequent reads to the owning region, or attach a freshness token, for a short window after their own write.
- Resharding (moving a range of keys from one region's ownership to another's) creates a window where both the old and new owner could believe they own a key. Mitigate with a two-phase handoff: briefly freeze writes on the range being moved, finish replicating it, then flip a versioned ownership pointer atomically, rather than changing ownership gradually while writes keep flowing.
Worked example
Bandwidth: at an aggregate 20,000 writes per second across all regions, each write (roughly 1 KB) replicated asynchronously to 2 peer regions for local read access:
20,000×1KB×2=40,000KB/s=40MB/s 40MB/s×86,400s/day≈3,456,000MB/day≈3.5TB/dayThat 3.5 TB/day is already the cross-region replication volume of the whole topology, not of one region (staying with one consistent, decimal MB-to-TB conversion throughout, 1,000 MB = 1 GB and 1,000 GB = 1 TB, so 3,456,000 MB is 3.456 TB, rounded to 3.5 TB/day). Check the units before multiplying it by anything: the 20,000 writes per second was defined as the aggregate rate across all regions, and the factor of 2 already charged every one of those writes for crossing to both of its peers, so multiplying again by the region count would count the same bytes three times. If writes split evenly, each region's own outbound share is about a third of the total, roughly 1.2 TB/day of egress apiece. The figure only reaches the 10 TB/day range under a different and much larger workload, one where 20,000 writes per second is the rate of each region rather than the aggregate (3 x 20,000 x 1 KB x 2 peers is 120 MB/s, about 10.4 TB/day), so say which of the two you mean before quoting a bandwidth bill to anyone. That is a real, ongoing cross-region data-transfer cost line that should be sized and budgeted, not discovered after the fact, and it argues for batching or compressing the replication stream rather than shipping each write as an individually tiny message.
SRE operational cost estimates
Runbook (the written, step-by-step procedure an on-call engineer follows to handle a specific situation) complexity grows by at least three genuinely new entries beyond a single-writer design: handling ownership-map changes safely, handling forward-path circuit-breaker states, and handling a resharding event without a split-brain window. On-call load concentrates specifically around two events: scheduled resharding operations (which should always be planned, not ad hoc under load) and any partial regional outage that breaks the forward path, since that turns what should be a purely local write for the affected users into a cross-region dependency exactly when the network is already unreliable.
Trade-offs and pitfalls
The core weakness of pure geo-sharding is that it can't relieve a hot spot by spreading writes to another region the way true multi-master could, since a key only has one legitimate owner; a region hit by a genuine spike (a viral event concentrated in one geography) can't be helped by routing its writes elsewhere without a slow resharding operation. A common wrong turn is treating the asynchronous replica in a non-owning region as good enough for a user who needs to see their own just-made write immediately; that specific case needs the sticky read-your-writes handling above, not a blanket assumption that "eventually consistent" is fine everywhere.
Unlock Full Question Bank
Get access to all Multi-Region and Geo-Distributed Systems interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.