Skip to main content

Online Chess

Difficulty: Hard

What It Tests

Real-time game state synchronization, matchmaking, session affinity, distributed state.

Topics Covered

Hello Interview Breakdown

Read the full Hello Interview breakdown →

Approach Hints

  • Use consistent hashing to assign each active game to a specific game server; both players connect via WebSocket to the same server for zero-latency move sync
  • Game state stored in Redis (fast reads and writes for active games) and persisted to PostgreSQL after each move for durability
  • Matchmaking service pairs players by ELO rating using a priority queue; tolerance expands over time if no match found
  • A distributed lock prevents race conditions when both players submit moves simultaneously; server validates move legality before broadcasting to both clients

Video Walkthroughs