Design an Online Game Leaderboard
MetaSoftware Engineer · Technical ScreenLast updated
A Meta software-engineer system-design screen: design the backend for an online game leaderboard supporting score recording, a global top-N board, a friends board, a player's rank and nearby players, and daily/weekly/seasonal/all-time windows at high write volume and low read latency. The model answer separates a durable score event log from an in-memory sorted ranking store, computes the friends board on read, and covers tie-breaking, caching, sharding, consistency trade-offs, anti-cheat, and rebuilds.
Question
Design the backend system for an online game's leaderboard.
The system should support:
- Recording and updating player scores from game sessions, with high write volume from many concurrent players.
- A global leaderboard showing the top N players by score (for example, the top 10 or top 100).
- A friends leaderboard showing the top players among a given user's friends.
- A player's own rank plus the nearby players around that rank (an "around me" view).
- Multiple leaderboard windows such as daily, weekly, seasonal, and all-time rankings.
- Low-latency reads for leaderboard pages even at very large scale.
Walk through the functional and non-functional requirements, the API design, the data model, storage choices, the ranking strategy (including tie-breaking), caching, the scaling approach, consistency trade-offs, anti-cheat/validation, and operational concerns. Explain how you keep the global, friends, windowed, and rank/nearby queries efficient when the player base and write volume are large.
Solution walkthrough is for members
Get the full walkthrough with reference code and complexity analysis, plus Kitty Coach at 300 messages a day. Hints, the code runner and community answers stay free.