Design a fault-tolerant and highly available data replication strategy across continents
Instruction: Design cross-continent replication for a database. State the consistency, latency, availability and recovery requirements, explain unavoidable partition/failover tradeoffs, and describe fencing, conflict handling and validation.
Updated
Official answer
Begin with the required consistency of each operation and the failure policy. A globally coordinated write pays cross-region communication latency; during a partition, a system cannot promise both linearizable operations and successful responses from every isolated region.
For an invariant such as preventing overselling, one possible design assigns each item a home write region and uses a documented synchronous quorum across selected failure domains. Define what happens when the quorum is unavailable: reject or queue writes rather than silently accept conflicting stock deductions. Local replica reads may be stale unless the chosen read mode provides a stronger guarantee.
Asynchronous regional replicas can serve permitted stale reads and aid recovery, but failover may lose acknowledged changes that never arrived. Set a measurable recovery-point objective and monitor replication lag. Promotion requires fencing the former writer to prevent split brain, followed by an explicit rejoin/reconciliation procedure.
Multi-writer designs need conflict semantics appropriate to the data. Last-write-wins can discard valid updates and depends on its ordering rule; CRDTs solve selected merge problems, not arbitrary cross-record business invariants. They do not imply simultaneous real-time updates everywhere.
Test partitions, delayed replication, region loss, promotion and failback. Retain independent backups for accidental deletion/corruption and validate restore. Report the latency, availability and data-loss tradeoffs of the chosen configuration.