Design a Geo-Distributed Leaderboard with Strong Consistency
Design a global leaderboard for a game that requires strong consistency (no stale scores). Focus on multi-master replication or single-region write dominance.
Why Interviewers Ask This
Google asks this to evaluate your ability to navigate the CAP theorem trade-offs in a real-world scenario. They specifically test if you understand that strong consistency globally often conflicts with low latency, and whether you can architect a solution like single-region write dominance or conflict-free replicated data types that prioritizes data integrity over availability when required by business logic.
How to Answer This Question
1. Clarify requirements immediately: Define 'strong consistency' as linearizability and confirm read/write patterns, such as frequent score updates versus occasional leaderboard queries. 2. Analyze constraints: Discuss the latency implications of global replication and why standard multi-master approaches might fail here due to split-brain risks. 3. Propose a primary region strategy: Suggest designating one geo-region as the primary writer for all score submissions to ensure a single source of truth, while using asynchronous replication for reads in other regions. 4. Detail the data flow: Explain how writes are queued, processed, and how stale reads are prevented during the propagation window. 5. Address failure scenarios: Describe how the system handles primary region outages using leader election protocols like Raft or Paxos to maintain consistency without data loss.
Key Points to Cover
- Explicitly acknowledging the CAP theorem trade-off between consistency and availability
- Proposing a Single-Region Write Dominance architecture to eliminate write conflicts
- Detailing a leader election mechanism like Raft or Paxos for high availability
- Explaining how to handle read-after-write consistency through routing or synchronization
- Justifying the choice based on the strict requirement for non-stale data
Sample Answer
To design a geo-distributed leaderboard with strong consistency, we must prioritize data integrity over global write availability. First, I would clarify that strong consistency implies linearizability, meaning every rea…
Common Mistakes to Avoid
- Suggesting eventual consistency without explaining how to meet the strict 'no stale scores' requirement
- Ignoring the high latency penalty of forcing global strong consistency on all nodes simultaneously
- Failing to define a clear failover strategy for the primary write region
- Overcomplicating the solution with complex conflict resolution algorithms when a primary region suffices
Sound confident on this question in 5 minutes
Answer once and get a 30-second AI critique of your structure, content, and delivery. First attempt is free — no signup needed.