← All problems
Dashboard
Courses
Problems
Badges
Theme
Sign inStart free
Problem 008 · Caching

Design a Game Leaderboard

Easy 30 min

Design the leaderboard for an online game. Players finish matches and their score updates. Anyone can see the global top 100, and each player can see their own rank and the players just above and below them. Rankings should feel live.

Functional requirements

  • Submit a score after a match
  • Show the global top 100
  • Show a player's rank and neighbours
  • Reset the board each season

Non-functional requirements

  • Top 100 loads in under 50 ms
  • A new score is reflected within 2 seconds
  • Scores are not lost if a cache node restarts

Constraints and scale

  • 20 million players
  • 5 000 score updates per second at peak
  • 40 000 leaderboard reads per second at peak

You will practise

  • Use an in-memory sorted structure for ranking
  • Keep a durable source of truth behind a cache
  • Handle read-heavy hot keys
Show 2 hints
  1. Which data structure returns rank in O(log n)?
  2. If the cache is wiped, how do you rebuild the board?

Ready to build?

Open the canvas, place your components and explain your decisions. Your draft saves automatically.

Sign in to start

Failure scenarios

  • The ranking cache restartsThe in-memory ranking node restarts during a tournament and comes back empty.

Run them from the workspace once your design is in place.