← Lessons

quiz vs the machine

Gold1410

System Design

The Matchmaking Service

Grouping waiting players into balanced, low latency matches under time pressure.

5 min read · core · beat Gold to climb

The grouping problem

The matchmaking service takes a stream of players who pressed play and forms them into matches. It must balance three goals that fight each other: skill balance, low latency, and short wait time.

How a queue works

  • Players enter a pool tagged with skill rating, region, and preferences.
  • The matchmaker repeatedly scans the pool for groups that satisfy constraints.
  • Each waiting player has a search window that widens over time, accepting wider skill gaps and farther regions the longer they wait.

This widening is the key trick. Early on it insists on a tight, fair match, but it relaxes rather than leaving someone stuck forever.

Scaling and fairness

  • Pools are often sharded by region so latency stays bounded.
  • Backfill handles players who leave mid match by slotting in newcomers.
  • The service must avoid starvation of rare populations like very high skill players.

Key idea

Matchmaking balances skill, latency, and wait time by widening each player's search window until a fair enough match forms.

Check yourself

Answer to earn rating on the learn ladder.

1. What three goals does matchmaking trade off?

2. Why does the search window widen over time?