Design an Online Multiplayer Chess Game
Quick Overview
Design a real-time online chess platform. Cover game state management, matchmaking with ELO ratings, move validation, spectator mode, and handling network disconnections gracefully.
0
Design a real-time online chess platform. Cover game state management, matchmaking with ELO ratings, move validation, spectator mode, and handling network disconnections gracefully.
This is a Google-style system design question about real-time, stateful systems with strict correctness rules. The interviewer is checking how you keep authoritative game state on the server, deliver moves with low latency over persistent connections, and survive disconnects without corrupting a game.
What the Interviewer Expects
- Gather functional and non-functional requirements, including latency and scale targets
- Keep the server authoritative for move validation and clocks
- Design matchmaking around rating bands that widen with wait time
- Use persistent connections (WebSockets) and a fan-out path for spectators
- Handle disconnects with reconnection windows and durable move logs
- Discuss sharding games by game_id and the trade-offs of the storage choices
Key Topics to Cover
How to Approach This
- Start by clarifying functional and non-functional requirements with the interviewer.
- Estimate the scale: QPS, storage, bandwidth. This drives your design decisions.
- Draw a high-level architecture first, then deep dive into 1-2 critical components.
- Discuss trade-offs explicitly (e.g., consistency vs availability, SQL vs NoSQL).
- Address failure scenarios, monitoring, and how the system handles 10x traffic spikes.
Possible Follow-up Questions
- How do you keep chess clocks fair when players have different network latency?
- How would you scale spectator mode for a top match with a million viewers?
- How would you detect engine-assisted cheating?
- What happens if the server hosting a game crashes mid-match?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice System Design ProblemsSample Answer
Requirements
Functional Requirements
- Real-Time Game State Management: The system must maintain the game state for each chess match, including player moves, timer, and game status (ongoing, check, checkm...
Capacity Estimation
Assuming each game lasts approximately 30 minutes and each game has 2 players:
- Concurrent Games: Targeting 10,000 concurrent games at peak times.
- Total Users: Assuming 60% of players are a...