KatInterview

Design a Real-Time Multiplayer Matchmaking Service

System DesignModel answer
HardModel answerSystem Designsystem-designdistributed-systemsgaming

Last updated

Design a scalable, low-latency matchmaking architecture capable of handling millions of players across diverse modes while keeping matches balanced, fast, and crash-resilient.

Design a real-time game matchmaking service for a large-scale online multiplayer platform.

Requirements & Scope

  1. Functional:

    • Queue Management: Solo players or pre-made parties can join, leave, or ping heartbeats in a queue for specific game modes and experiences.
    • Match Generation: Form balanced matches based on player skill (e.g., ELO / TrueSkill), ping to target regions, party size, and queue wait times.
    • Backfilling: Game instances with empty seats (e.g., due to player disconnections) can request backfill matches mid-game.
    • Long-tail vs. Popular Titles: Support both mega-popular titles (hundreds of thousands of concurrent queueing players) and a long tail of niche game modes with tiny player pools.
  2. Non-Functional Targets:

    • Latency: API response times (Join/Leave/Heartbeat) $p99 < 50\text{ ms}$. Match waiting time targets $p50 < 5\text{ s}$, $p95 < 30\text{ s}$, with hard timeouts around $120\text{ s}$.
    • Network Quality: Match players to region servers where average round-trip time (RTT) is $< 80\text{ ms}$ (hard ceiling $< 150\text{ ms}$).
    • Correctness: Under no circumstances should a player be assigned to two active matches simultaneously.
    • Availability: $99.95%$ uptime for API ingestion.

In your design, cover:

  • High-level architecture and system components.
  • Data models, APIs, and state machine transitions for tickets.
  • Capacity planning (throughput, network, memory).
  • Detailed algorithm for match formation and relaxation windows.
  • Partitioning, sharding, consistency guarantees, and failure handling.

Hints

Hint 1

Think about who owns the state: handling concurrent state mutations across distributed matchers is tricky. Can single-writer sharding simplify concurrency control?

Hint 2

Consider how skill bounds should behave over time. A static skill filter causes starvation for extreme high-skill or low-skill players.

Hint 3

Calculate memory footprint versus CPU bound work: matchmaking for 10 million online users is surprisingly CPU/IO bound rather than RAM bound.