Case study: design a leaderboard
Interview question: design the leaderboard for a mobile game with 50 million daily players. Show the top ten, your own rank among 100 million, and boards that reset every day and every week. A database ORDER BY works for a thousand players. What do you do for 100 million?
In this lesson you'll learn to
- Turn the leaderboard question into requirements and numbers, and separate the global board, your rank, friends and time windows.
- Serve top-K, a player's rank and the players around them from sorted sets, and break ties deliberately.
- Scale past one node by sharding, sharded counters and batching, and choose between exact and approximate ranks.
- Run daily and weekly boards as separate keys that expire, build rolling windows by merging, and rebuild everything from a durable log.
Create a free account to open this lesson
It's free. You'll get every free lesson, quizzes that save your progress, daily flashcards and streaks.