Preparing your design workspace

Loading the problem and your latest saved attempt…

Design a Player Matchmaking Queue

Design a regional queue that forms compatible player pairs and preserves a clear result across cancellations, disconnects and retries.

Problem statement

For this exercise, assume a single multiplayer game mode forms matches of exactly two players with the same preassigned region and skill band. Design joining, heartbeats, cancellation, compatible pairing and result delivery.

In this regional deployment, a player may have at most one QUEUED ticket, and a ticket may belong to at most one match. A ticket ends as MATCHED, CANCELLED or EXPIRED and cannot be revived. A match racing with cancellation or expiration must produce one durable outcome.

Clients can reconnect and query their result even if a notification was lost; duplicate notifications are allowed. The attempt ends at that terminal queue result: rating assignment, parties, gameplay, game-server provisioning and cross-region coordination are outside scope.

What to build

  1. An authenticated player can join a queue and renew a live ticket; retrying the same join key returns the original ticket/result, and another key cannot create a second QUEUED ticket.
  2. A queued player can cancel, or an inactive ticket can expire; a late heartbeat cannot revive it. If matching already won, cancellation returns the existing match result.
  3. The service forms a match from two distinct, compatible, still-QUEUED and unexpired player tickets without assigning either ticket twice.
  4. Both players can query a durable terminal result after reconnecting and receive a match notification, with retries and duplicates tolerated.

At scale

  • For this exercise, assume one regional deployment has 100000 online players, at most 10000 QUEUED tickets, and a peak of 5000 combined join, heartbeat, cancel and status requests per second.
  • Target API p95 latency below 200 ms and eligible-pair commitment within 5 seconds at p95 under normal declared load. Queueing and matching need not complete in the join request.
  • An accepted join starts a 60-second lease using server time. Clients heartbeat every 10 seconds, and each accepted heartbeat renews that server-owned deadline for 60 seconds. Matching must respect the deadline even before background cleanup.
  • Retain terminal ticket and match outcomes for 24 hours for retry/reconnect queries. Notifications may be delivered more than once; gameplay completion and later game sessions are outside this exercise.