System Design Atlas

Live sports interaction for large audiences

07 / 10Worked example

Critical flow

An account has exactly one winner. What conditions ensure the result?

Two devices send different options.

Starting point Separate workers and datastores implement different rules.

Assumptions for the example case

A fictional audience poll on the best play. Each account can cast at most one immutable vote per poll. Chat has a separate moderation path. All quantities, thresholds and operational objectives of this design are illustrative assumptions.

Two options of the same account

Two options of the same account

The unique barrier applies to U-51 and P-51.

Browser A
Interaction API
Vote partition
Browser B
  1. 01 Browser A → Interaction APIOption A
  2. 02 Interaction API → Vote partitionAccept atomically
  3. 03 Browser B → Interaction APIOption B
  4. 04 Interaction API → Browser BAlready voted

Result: The first commit wins; a retry reads the original vote.

Account, poll and deadline are checked together at commit.

Browser devices → API → uniqueness for account and poll; the first commit wins; a retry reads the original vote.

Commit, response loss and resumption

U-51 still without vote
Options A/B and B/A submitted concurrently → exactly one vote; the first successful acceptance wins.
V-51 accepted
Identical retry after the deadline; another option under the same key → original vote returned; changed retry causes a conflict.
Deadline 60,000 ms
Decision time 59,999/60,000/60,001 ms → acceptance allowed only at the first time.

Exactly one vote wins per account.

Exactly one vote wins per account.

A unique key on account and poll protects acceptance.

Two devices send different options.

A counts once; B is rejected because the account has already voted. B counts once; A is rejected because the account has already voted.

Alternative considered
Later aggregation would count double.
Trade-off
A losing request cannot change the accepted choice.
Reassess
Allowing vote changes would require a different contract.

Try it yourself

Predict both orders.

A hint for your attempt

Two devices send different options.

Compare with a possible solution
A first
A counts once; B is rejected because the account has already voted.
B first
B counts once; A is rejected because the account has already voted.

Apply to your project

What is the equivalent of “An account has exactly one winner” in your own project?

Step 8: Backlog needs the correct measuring point. What conditions ensure the result?