Design a live sports scores system
Design a service that pushes live sports scores to millions of people watching the same match at the same time. A score update should reach everyone within a second or two.
About this problem
“Design a live sports scores system” is a core-level problem in the live push family. The server has to speak first, to a lot of people, at the same time.
The key challenge: A second or two of slack, bounded by something outside your system: the person in the next room shouting at their television.
Time budgets: Delivery: 1–2 seconds. Connection setup: seconds. Reconnect: seconds.
The worked solution for Live scores goes through why those budgets shape the design, stage by stage.
Before you start
You will work this in five timed stages. Here is what each one asks you to think about. None of it is the answer; the answers unlock in the workspace below once you have written your own.
- Stage 1 · Requirements · 5 min
- What is the traffic shape for a sports app? It is not uniform.
- Does every viewer see the same data, or personalised data? That changes everything.
- How many distinct matches are live at once?
- Stage 2 · Actors and lifecycle · 6 min
- Follow the event from the provider to a phone.
- What happens to someone whose train goes into a tunnel?
- What if the provider sends the same goal twice, or takes one back?
- Stage 3 · Numbers · 6 min
- How many events happen in one match? Count them.
- Multiply events by viewers. That is the real number.
- How much memory does a connection cost?
- Stage 4 · High-level design · 12 min
- Which transport, and why not the other two?
- How does a server know which of its connections care about this match?
- What happens between a message arriving and it hitting ten million sockets?
- Stage 5 · Deep dive and tradeoffs · 14 min
- Ten million people connect in the ninety seconds before kick-off. Walk through it.
- You need to deploy during a match. What happens?
- What does a slow client do to your server?
Work it through
Five stages, gated. You write your answer for each stage before its model answer unlocks. That is the core of the method.
Done all five? The diagrams, numbers, trade-offs and follow-ups for this problem are on the worked solution page, to check your own design against.
How it is really built
Write your own answer first. Then read how teams who run this at scale describe it. Their constraints were real, and the write-ups often say what their choices cost.
- MDN — WebSockets API ↗The bidirectional alternative weighed against SSE in Stage 4.