AlgoViz

Design a Multiplayer Game Leaderboard

easy 45 min

Keep 250 million players in order while results arrive all the time, and tell any of them their place in milliseconds.

Agree on the scope

Ask what changes the design, then commit to a short list.

Clarifying requirements

  1. Interviewer

    Design a leaderboard for a multiplayer game.

  2. You

    First, how is a score made, and who sends it?

    • Best score, sum of points, or a rating?
    • How many players a day, and how often do they look?
    • Which boards: global, region, mode, friends?
    • Which periods?
    • How old may a place be?
    • Are there prizes?
  3. Interviewer

    Best score in the week. 100 million players a day, five matches each, about 50 looks. Global, region, mode and friends. Weekly and all time. A few seconds old is fine. Small prizes each week.

  4. You

    Then results come from our game servers and I keep every one. I will build the weekly global board first, then ranks, then friends. Guilds and replays are out of scope.

Functional requirements

RequirementPriority
Accept and update scores as matches endMust have
Top N of any boardMust have
My rank, neighbours and percentileMust have
Global, regional, mode and friends boardsMust have
Check scores for cheatingMust have
Daily, weekly, season and all-time boardsShould have
Tell a player about a new placeShould have
History of a player's placesNice to have

Quality targets

QualityTargetWhy
Scale100M players a dayFive matches and 50 looks each
Read latencyp99 under 50 ms at our serviceA board opens inside the game
Accept a resultp99 under 100 msThe match screen is waiting
Freshness2 to 5 s on boards, 10 s more on the top listNobody notices
DurabilityNo accepted result lostIt may decide a prize
Availability99.9%, and the game runs without usA board is not the match