Phase 1 — Clarify & Scope
Interviewer: Design a real-time gaming leaderboard — think a global leaderboard for a mobile game or an esports tournament ranking system. What do you want to clarify?
Candidate: A few questions:
- What's the leaderboard scope — global (all players), regional (per country), or per-game-session (temporary)?
- What triggers a score update — end of match, continuous score during gameplay, or daily aggregation?
- What's the read pattern — top-N query, or arbitrary rank lookup (where am I ranked among 100M players)?
- How many players and score updates per second?
- Does the rank need to be exact, or can it be approximate?
Interviewer: Global leaderboard for a mobile game. 100 million players, each with a cumulative lifetime score. Score updates happen at match end — about 10 million matches completed per day. Reads: display top-100 globally, plus the requesting player's rank and score. Exact ranks required. Near real-time updates — rank should reflect the latest completed match within 30 seconds.
Candidate: Let me size this:
For rank calculation: 100M players sorted by score. A naive SQL COUNT(*) WHERE score > player_score takes O(N) — unacceptable at 100M rows.
Interviewer: What are the core requirements?
Candidate:
- Update player score (atomic increment, not absolute…
In the full tutorial
- Phase 2 — High-Level Architecture
- Phase 3 — Deep Dive & Evolution
- Phase 4 — Robustness & Operations