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.
Define split-brain in a multi-region distributed system. Explain at least three concrete operational strategies to prevent split-brain (for example quorum, fencing, network-layer controls). For each strategy describe advantages, limitations, and the simplest way to validate the preventive mechanism in production.
Sample Answer
Split-brain is when a network partition causes two (or more) nodes or regions to each independently believe they are the sole active leader or primary, and each keeps accepting writes without knowing about the other, producing two diverging copies of state that were never supposed to exist at the same time.
Strategy 1: quorum. Quorum means requiring agreement from a majority of members, for example 3 of 5, before a write or a leader election is considered valid. A minority-side region cut off by a partition physically cannot reach a majority, so it cannot elect a leader or accept writes, it can only become read-only or refuse traffic. Advantage: this is a mathematical guarantee, not a timing-dependent heuristic, since a partition can produce at most one side with a majority. Limitation: it costs write latency (every decision needs a round trip to a majority of members, which across regions can add real tail latency) and reduces availability on the minority side rather than degrading it gracefully. Simplest validation: run a scheduled drill that isolates a minority region's network and confirms it correctly refuses to elect a leader or accept writes.
Strategy 2: fencing. A fencing token is a number that only increases, issued to whichever node currently holds leadership; every place that a leader writes to must check the token and reject anything carrying an older one. This protects you even against a leader that is fully alive and confidently, wrongly, still trying to act as leader after a partition. Advantage: it stops a stale leader's writes even when the stale leader itself never realizes it's been replaced. Limitation: it only works where it is actually enforced, a single write path that forgets to check the token is a hole in the whole scheme. Simplest validation: cut network access to a leader without killing its process, then confirm a new leader is elected with a higher token and that the old leader's write attempts are rejected downstream.
Strategy 3: network-layer controls. Withdraw traffic from a degraded region at the network level, for example removing it from anycast (a routing technique where the same address can resolve to the nearest of several regions) or from a global load balancer's DNS answers, rather than relying on the region to detect its own problem and step aside. Advantage: this works even when the region's own health-check logic is the thing that is broken. Limitation: it depends on an external, healthy control plane to notice and act, and DNS-based approaches propagate slowly (client-side caching can mean real traffic keeps arriving for minutes after the change). Simplest validation: black-hole one region's inbound route in a controlled drill and measure how long it actually takes for end-to-end traffic to stop arriving.
An EU customer requires data residency for personal data while still wanting global users to experience low latency. Propose an architecture that satisfies GDPR residency requirements for EU customers, supports replication for analytics, and minimizes complexity for operations. Discuss encryption, pseudonymization and where application-level routing is needed.
Sample Answer
Direct answer
Satisfy the legal requirement first, EU personal data physically stored and processed in the EU, and treat global low latency as a routing and caching problem layered on top, not a reason to relax the residency boundary.
Framework
- Architecture: run a dedicated EU region, or region pair, as the system of record for EU customers' personal data. Non-EU users route to their nearest region for everything that doesn't touch EU personal data, and any request that does need EU data crosses as a narrow, audited API call rather than a data copy.
- Encryption: encrypt EU personal data at rest with keys managed by an EU-resident key management service (KMS), so the ciphertext and the key together never legitimately exist outside the EU.
- Pseudonymization, and the line it does not cross: replace direct identifiers, name, email, with a pseudonymous token everywhere outside the EU region, and keep the token-to-identity mapping inside the EU region only. This is a genuine and worthwhile risk reduction, and it is also the single most common place an architecture like this gets described incorrectly, so be precise about it: under GDPR, pseudonymised data is still personal data. The regulation defines pseudonymisation as processing after which the data can no longer be attributed to a person WITHOUT additional information kept separately, and the fact that the additional information exists at all, in your EU region, under your control, is exactly why the pseudonymised copy stays in scope. Only anonymisation, where re-identification is irreversible for everyone including you, takes data out of scope, and the moment you hold the mapping you have not anonymised anything.
What follows is concrete rather than pedantic. The globally replicated event stream is still personal data, so it still needs a lawful basis, the regions outside the EU still need a transfer mechanism, and a deletion request still has to reach it, which means the token has to be usable to find and erase those rows rather than being a one-way hash nobody can search on. What pseudonymisation actually buys is a much smaller blast radius if that global store is breached, plus a defensible record that appropriate technical measures were in place. What it does not buy is an exemption from the residency and transfer rules, and a candidate who claims it does has just failed the compliance half of the question.
If you want data genuinely out of scope, aggregate before it leaves: counts and rates over cohorts large enough that no individual can be singled out, with the per-user event rows staying in the EU. That is a real trade with a real cost, since you give up the ability to ask new per-user questions of the global store later, and saying so out loud is what separates a considered design from a hand-wave. - Where application-level routing is needed: at the API gateway, route by a resolved "home region" field set on the account at signup based on residency, not by current IP, so every write for that account always goes to its home region. Reads of already-pseudonymized, non-personal aggregates can be served from the nearest region's cache.
- Minimizing operational complexity: keep the number of home regions small and centralize the routing logic in one shared gateway or SDK layer rather than letting every service reimplement its own residency check, which is where these systems typically drift out of compliance.
- Cost and validation (the multi-country angle): every additional jurisdiction with its own residency rule is close to a linear increase in infrastructure cost, since you're standing up close to a full regional stack, not a config change, so a new region should be justified by actual customer demand there. Validate the whole design continuously, for example a scheduled job asserting no personal-data table has ever received a write from a non-EU service credential, rather than relying on a one-time architecture review.
Worked example
Signup sets home_region to the EU for an EU customer. Their profile writes always route there. Product usage events are pseudonymized at write time with a token, so a team anywhere can compute global engagement metrics without ever holding an EU user's real email address. The shared analytics warehouse those events replicate into is registered as an in-scope personal-data system rather than treated as exempt, which means it inherits a transfer mechanism, a retention limit, and a deletion path keyed on the token. The cohort-level rollups computed from it, daily active users by country and by feature, carry no per-user row and are the copy that circulates freely inside the company.
Trade-offs and pitfalls
Calling a pseudonymised global store anonymous, and therefore out of scope, is the most expensive mistake available here, because it is normally discovered during an audit or an unanswerable deletion request rather than during design, at which point the store has years of data in it. Separately, a pseudonymisation that can be trivially reversed by joining another globally available field, a rare timestamp plus a coarse location will often do it, fails even on its own weaker terms and is a common audit finding. Deriving "home region" from current IP instead of a fixed account attribute breaks the moment a user travels.
Propose a capacity planning approach for inter-region bandwidth when continuous replication of large datasets is required: 1 TB per hour between regions with variable inter-region RTT (~100ms ± 50ms). Describe throttling, burst handling, replication scheduling, and cost trade-offs including choosing between dedicated links and internet transfer.
Sample Answer
Direct answer
1 TB/hour of continuous replication works out to roughly 2.2 Gbps sustained average, small
enough to fit comfortably on a single 10 Gbps dedicated circuit, but the plan should
provision meaningful headroom above that average, not a link sized exactly to it, because
variable round-trip time (RTT) and any transient interruption both create catch-up bursts
that need spare capacity to absorb without falling permanently behind.
Working through the numbers
Using decimal units (1 TB = 1000 GB = 1,000,000 MB, the convention for network throughput):
3600 s1,000,000 MB≈277.8 MB/s 277.8 MB/s×8=2222 Mb/s≈2.2 Gbps sustained averageThat average fits well inside a single 10 Gbps circuit (roughly 22% utilization), which
looks generous, but "continuous" and "variable RTT" both push toward provisioning above the
bare average: a higher RTT reduces the effective throughput a single connection can sustain
(the amount of unacknowledged data in flight is capped by the connection's window, and a
longer round trip means that cap is reached sooner relative to available bandwidth), so at
the high end of the stated ~100ms ± 50ms range (150ms), sustaining the full 2.2 Gbps may
require multiple parallel streams or a tuned window size rather than assuming one connection
scales linearly with the circuit's rated speed.
Design
Throttling. Cap the replication stream at a defined ceiling below the circuit's full
capacity (for example, 80% of a 10 Gbps circuit, 8 Gbps) using a token-bucket-style limiter,
so replication traffic never fully starves other traffic that might share the same link
(monitoring, control-plane calls, ad hoc cross-region queries).
Burst handling. Allow the throttle to permit short bursts above the steady 2.2 Gbps
average, up to the throttle ceiling, specifically to drain any backlog that accumulates
during a period of elevated RTT (say, when RTT sits at the upper end of the stated range).
A token bucket naturally supports this: it accumulates capacity during quiet periods and
allows spending it faster during a catch-up window, without permanently raising the
sustained rate.
Replication scheduling. If any part of the 1 TB/hour is not latency-sensitive (periodic
bulk syncs, full backups, batch exports rather than live change replication), schedule that
portion during lower-traffic windows so it doesn't compete with latency-sensitive
foreground traffic for the same circuit capacity.
Cost trade-off: dedicated link versus internet transfer. A dedicated interconnect gives
a reserved, predictable capacity and typically more favorable (or flat) pricing on the data
actually moved compared to variable public internet egress, which matters for a workload
this large and continuous: 1 TB/hour is roughly 720 TB/month, a volume where the difference
between a reserved circuit and metered internet egress compounds quickly. The trade is the
dedicated link's fixed cost and provisioning lead time versus the internet path's
flexibility and near-zero setup time; for a workload described as continuous and volume-
predictable, the dedicated link is the better long-term default, with internet transfer kept
as a fallback path for burst overflow or as a temporary bridge while the dedicated circuit
is being provisioned.
Trade-offs and pitfalls
- Don't size the circuit to the bare average. A link sized at exactly 2.2 Gbps leaves no
room to catch up after any interruption, and the RTT variability explicitly called out in
the question is a signal that some headroom is needed, not just for the number but for the
transfer efficiency at higher RTT. - A single TCP connection may not use all of a large circuit's capacity at the higher end
of the RTT range; if throughput monitoring shows a gap between the circuit's rated
capacity and what the replication stream actually achieves, check whether parallel streams
or window tuning close that gap before assuming more raw bandwidth is needed. - Scheduling bulk, non-urgent replication for off-peak windows only helps if something else
is actually peak on that link; if the link is dedicated to this replication and nothing
else, scheduling changes when the load happens, not how much total capacity you need.
Design an architecture to provide global session stickiness for write operations while allowing reads from any region. Include session token design, storage for session mapping (e.g., regional store vs global store), implications for failover, cache invalidation, and capacity planning for session stores.
Sample Answer
Direct answer
To keep writes sticky to one "home" region per user while still allowing fast reads from anywhere, the session token itself should carry the user's home region and a write-version marker, so any edge or region can route a write correctly and judge whether its own local data is fresh enough to serve a read, without a slow global lookup on every request.
Structured elaboration
- Session token design: encode the owning ("home") region and a monotonically increasing sequence number representing the user's latest known write directly in the token. Any region receiving a write request can route it to the correct home region using only the token; any region receiving a read request can compare its local replica's applied sequence number against the token's number to decide if it's safe to serve locally.
- Storage for the session-to-region mapping: keep a fast, regional cache of "who owns this session" near each edge for quick reads, backed by a lightweight, globally propagated source of truth for that mapping specifically. The mapping itself changes far less often than the session data it points to, so it's a good candidate for asynchronous global replication even in a system that otherwise cares about strong consistency for the data itself; routing every single request through a global lookup would defeat the entire purpose of allowing fast local reads.
- Failover implications: if a user's home region fails, their session needs to be reassigned to a new home region as part of the regional failover process, which means capacity planning (below) has to account for home-region assignments shifting, not staying fixed.
- Cache invalidation: the mapping cache's time-to-live (TTL) needs to be short enough that a home-region reassignment during a failover propagates within the target recovery time objective (RTO), but long enough that normal operation isn't constantly re-fetching ownership on every request. A TTL in the 30-60 second range is a reasonable middle ground against a roughly 15-minute-class RTO, combined with an explicit invalidation push triggered directly by the failover automation itself, rather than relying purely on the TTL to expire during an actual incident.
- Capacity planning for session stores: size each home region's session capacity to its actually assigned population, which usually isn't evenly split across regions, and provision meaningful burst headroom in the surviving regions to absorb a meaningful fraction of a failed region's reassigned sessions, not just each region's own steady-state baseline.
Worked example
On a read, the local region checks: is my local replica's applied sequence number greater than or equal to the number in the user's token? If yes, serve the read locally, the fast path that should cover the large majority of requests. If no, wait a small bounded amount, for example up to 200 milliseconds, for replication to catch up, and if it still hasn't, fall back to routing the read to the user's home region rather than serving stale data. This gives most reads the fast local path while putting a firm bound on how stale a served read can be.
Sticky versus stateless (the underlying design choice)
A fully stateless design, where the client-held token carries everything needed and there is no server-side session record at all, avoids all of the mapping infrastructure above, at the cost of a larger token and a harder story for server-side session revocation or inspection. The sticky design described here gives central control and smaller tokens, at the cost of exactly the mapping and cache-invalidation machinery above. In practice, lean stateless for whatever genuinely can be (short-lived authentication claims, for example) and reserve this sticky-write-ownership machinery for the parts of the session that truly need server-side, revocable state.
Trade-offs and pitfalls
The pitfall to avoid is putting the entire session object, not just its ownership and version metadata, into the globally-consulted mapping store. That reintroduces the exact cross-region latency problem this whole design exists to avoid, since now every session read pays a global lookup instead of a local one. Keep the globally propagated piece as small and infrequently changing as possible, and let the actual session data live and replicate the way ordinary application data does.
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.
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.