Designing Data-Intensive Applications
Case 6

Sharding and Matchmaking

Scale horizontally by adding game server processes; matchmaking is the control plane.

In practice

Call of Duty warzone spins thousands of single-match processes across cloud VMs. Control plane tracks capacity; data plane is ephemeral per round.

typescript — Regional matchmaking queue
// Regional matchmaking with skill bucket
type Ticket = { playerId: string; mmr: number; region: string };

function findMatch(queue: Ticket[]): Match | null {
  const ready = queue.filter((t) => t.region === "eu-west");
  if (ready.length < 10) return null;
  const avg = ready.reduce((s, t) => s + t.mmr, 0) / ready.length;
  const picked = ready.filter((t) => Math.abs(t.mmr - avg) < 200).slice(0, 10);
  return { players: picked.map((t) => t.playerId), serverShard: "eu-west-3" };
}
Key Takeaways
  • Each match is an isolated process — natural parallelism boundary.
  • Matchmaking queues partition by mode/region/rank.
  • Backpressure when server pool full: queue wait UX vs degraded bots.
  • Cross-region play only when product accepts high ping.
  • Telemetry pipeline (Kafka) feeds ranking and crash analytics.
  • Stateful sets or Agones allocate UDP ports per pod.
shardingmatchmakingAgonesregionaltelemetryUDPbandwidth