Design a Chess Matchmaking System

Normal+ 4
Real-TimeWebSockets TikTok

Design online chess inside a big consumer app: a player taps Play, gets matched with someone near their rating within a few seconds, and plays a timed game in real time.

Functional:

  • Join a queue for a time control (1+0 bullet, 3+2 blitz, 10+0 rapid) and get an opponent near your rating.
  • Play live: each move reaches the opponent fast, both clocks run, and illegal moves are rejected.
  • Reconnect after a dropped connection and carry on with your clock still running.
  • Ratings update after every finished game, and finished games are kept for replay.

Non-functional:

  • Median time to match under 5 seconds in a busy rating range. Nobody waits more than 30 seconds without being offered a wider match.
  • Move delivery under 150 ms at p99 inside a region.
  • A game's result is decided exactly once, even when both clients claim a win at the same moment.
  • A crashed server does not lose a game in progress.
  • 3 million daily players, 300,000 online at peak, 150,000 games in progress.
  • A bullet game is about 80 moves in 2 minutes. Peak move traffic is around 20,000 moves per second.
  • 8 million finished games a day at about 2 KB each.

Cheat detection, tournaments, in-game chat, and the rest of the app.

System design
Loading editor...