Back to sketch

SYSTEM DESIGN SKETCHBOOK / PRACTICE SHEET / NO. 48

Design live comments for live video

Advanced · 45 min · Real-time delivery

While a live video plays, viewers type comments that scroll past for everyone else watching. A small stream has a few dozen viewers; a big event has millions on one stream, all expecting to see the chat move in real time and to see a removed comment vanish.

Requirements

  • Post a comment on a live video.
  • Everyone currently watching sees new comments within about 2 seconds.
  • A viewer who joins or reconnects sees the most recent comments first, then the live flow.
  • Comments are screened by an automatic filter, and a moderator can remove a comment so it disappears from screens that already show it.

Constraints and assumptions

  • 10,000 concurrent live videos at peak with 20 million viewers in total; the largest single stream has 2 million.
  • Up to 100,000 new comments per second overall; the largest stream can see 2,000 per second.
  • One connection server holds about 100,000 viewer connections.
  • A person can read roughly 5 to 10 comments per second on screen.
  • Comments are up to 300 characters; delivery p99 within 2 seconds of posting.

Out of scope for the first sketch

The video stream itself · Reactions and like counts · Comment replay after the broadcast ends

Draw your design

Rough math and notes

Done on paper? Compare with the worked approaches