Section 8: Ten Thousand Boards at the Top of the Hour - Deep Dive: Tournaments — Pairing, Round Starts and Standings
Executive Summary: Each tournament is one director actor in its home region. It owns registrations, pairings and standings, persists to that region's Postgres, and learns results from game-ended, idempotently by game_id. Games never wait on it. An Arena pairs whoever is waiting every 2 s (~120 players, 60 games per wave) and scores win 2, draw 1, loss 0, with streaks and berserk on top. A Swiss pairs 1,000 games per round with a Dutch-system engine, and each round waits for its last board. The hard part is the start: 10,000 games in 5 s for one Arena, and 3,000 games/s across the top of the hour. We pre-scale 10 min ahead, create games in batches, and put the board in the start push. Standings go out every 2 s: the shared top 10 via Pub/Sub, each player's own row only when it changes.
You: "Section 7 solved one game. A tournament is ten thousand of them plus a scheduler. The games don't change; the load shape and the bookkeeping do."
Two Formats, Two Load Shapes
| Arena | Swiss | |
|---|---|---|
| Running example | Saturday Blitz Arena, 3+0, 90 min | Weekend Blitz Swiss, 3+2, 9 rounds |
| Typical size | up to 20,000 | up to 2,000 |
| Pairing trigger | a wave every 2 s over whoever is waiting | once per round, for everyone |
| Scoring | 2 / 1 / 0, streaks double, berserk +1 | 1 / ½ / 0, bye 1 point |
| Waiting | ~1 min between games | the whole round, plus a 1-minute gap |
| Stragglers | nobody waits for anybody | round N+1 waits for round N's last game |
Sign in to continue reading
The rest of this lesson is available with a free account. Signing in with Google or Microsoft is free.
Sign in to read the full lesson