System Design: Game Leaderboard
Design a backend service that powers leaderboards for an online game.
Core functionality
-
Players submit score updates (or score deltas) for a given
game mode
and
season
.
-
Clients can query:
-
Top K
players for a leaderboard (e.g., top 100)
-
A given player’s
current rank
and
score
-
A
range around a player
(e.g., ranks 9,950–10,050)
-
Support
ties
deterministically (e.g., same score → break ties by earliest timestamp or player_id).
Non-functional requirements (you may assume numbers)
-
Large scale (e.g., tens of millions of players; up to hundreds of thousands of score updates/sec at peak).
-
Low read latency (e.g., p95 < 100 ms for top-K queries).
-
“Near real-time” freshness (e.g., leaderboard reflects updates within a few seconds).
-
High availability across regions.
Constraints / discussion points
-
Score update semantics: only allow
monotonic increase
(best score) vs allow arbitrary overwrites.
-
How to handle
seasons/resets
,
multiple regions
, and
multiple game modes
.
-
How to prevent/mitigate
cheating
and abusive update patterns.
Provide APIs, data/storage design, scaling strategy, and consistency tradeoffs.