FSD Frontend System Design

Part VI โ€” The Blueprint ยท Lesson 11.7

HLD โ€“ Live Commentary (CricInfo, Cricbuzz)

In one lineOne event fans out to millions of read-only clients โ€” the design problem is broadcast, not interaction.

Where you've seen itA wicket in a World Cup final. Nobody is sending anything; everybody is receiving the same thing at once.

  • Time18 min
  • DiagramFan-out from one event to N clients + the spike profile
  • Chapter11 ยท High Level Design

Diagram

diagram
1โ€“2 ยท SCOPE AND SCALE

  in scope   live score ยท ball-by-ball commentary ยท scorecard
  out        chat ยท betting ยท video ยท fantasy leagues
  scale      10M concurrent at peak ยท 1 event every ~30s normally,
             bursts around wickets ยท traffic 50ร— baseline in minutes
             READ-ONLY: clients never write
diagram
3 ยท FAN-OUT โ€” one event, ten million deliveries

                  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                  โ”‚ scoring feed โ”‚  1 event
                  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                         โ–ผ
                  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                  โ”‚   pub/sub    โ”‚
                  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
              โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
              โ–ผ          โ–ผ          โ–ผ
        โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
        โ”‚ edge PoPโ”‚โ”‚ edge PoPโ”‚โ”‚ edge PoPโ”‚   SSE connections held here
        โ””โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”˜โ””โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”˜โ””โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”˜
        ~3M      ~3M       ~4M clients

  SSE (2.5), not WebSocket: clients only receive, and SSE gives
  auto-reconnect and Last-Event-ID replay for free.
diagram
6a ยท DEEP DIVE โ€” TRANSPORT CHOICE AND FALLBACK

  primary    SSE          one-way ยท plain HTTP ยท free reconnect
  fallback   short poll   for proxies that block streaming (2.2)
                          10s interval + ETag โ†’ cheap 304s

  degrade under extreme load:
    normal   push every event
    spike    coalesce: one update per 2s carrying the latest state
    extreme  fall back to polling a CDN-cached score.json (TTL 5s)
             โ† survives ANY load, because it's just a cached file
diagram
6b ยท DEEP DIVE โ€” THE SPIKE PROFILE

  concurrent viewers
    โ–ฒ
  10Mโ”‚                    โ•ญโ”€โ”€โ•ฎ  wicket / last over
    โ”‚                    โ”‚  โ”‚
   5Mโ”‚         โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ  โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
    โ”‚   โ•ญโ”€โ”€โ”€โ”€โ”€โ•ฏ                    โ•ฐโ”€โ”€โ”€โ”€
   1Mโ”‚โ”€โ”€โ”€โ•ฏ
    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–บ time
      pre-match   innings        finish

  Design for the peak, and make the degraded mode automatic โ€”
  a CDN-cached JSON poll is the floor you can always fall back to.

How it works

  1. SSE per client, terminated at edge PoPs so no single origin holds ten million connections.
  2. Send deltas, not the whole scorecard โ€” a ball event is tiny; the full state is not.
  3. Include a monotonic event id so reconnects resume via Last-Event-ID with no gap (2.5).
  4. Coalesce under load: batch to one update every second or two; nobody perceives the difference.
  5. CDN-cached JSON with a short TTL as the guaranteed fallback โ€” it scales infinitely because it's a static file.

Trade-offs

ChoiceCost
SSENo clientโ†’server channel (not needed here)
WebSocketDuplex you don't use, harder scaling
CDN-cached pollingUp to TTL seconds stale; infinitely scalable
Delta eventsClient must hold and patch state correctly

Interview angle

"Ten million concurrent viewers. WebSocket or SSE?"

  • SSE: the traffic is entirely one-way, and reconnect plus replay come free, which is the expensive part of a WebSocket build.
  • Terminate connections at edge PoPs fanning out from pub/sub, so the origin publishes once.
  • Then name the degradation ladder: full push โ†’ coalesced push โ†’ CDN-cached JSON polling, so peak load has a floor.

Recap

  • Read-only fan-out means SSE, not WebSocket.
  • Send deltas with event ids; reconnect resumes automatically.
  • Always have a CDN-cached polling fallback โ€” it's the only mode that can't be overwhelmed.