Skip to content

Case study: Real-time leaderboard

Design a real-time gaming leaderboard for 25M players using augmented skip lists (Redis sorted sets), a 1-second top-K cache, and a durable score ledger.

35 min9 steps

By the end you can
  • Estimate memory footprint and update/read QPS to prove when a global leaderboard fits on a single in-memory node
  • Explain how an augmented skip list computes exact player rank in O(log N) time whereas SQL COUNT(*) degrades to O(N)
  • Compare user-hash partitioning and score-range bucketing when a leaderboard outgrows one machine
  • Predict system behaviour under tournament-finale spikes, cache flushes, and durable ledger slowdowns

Pin down the leaderboard queries

Queries

  • Update score; top 100; exact rank + five neighbours

Targets

  • Updates visible <100 ms; reads p99 <50 ms

Safety

  • Earned points survive memory-node loss

Why does a standard SQL database with a B-tree index on `score DESC` struggle with the 'Player's own rank' query at 25M rows?

Answer this step to continue.