System Design Problem

Design a Live Comments System (like Facebook Live / YouTube Live)

Commonly Asked By:MetaGoogleTwitchByteDance

  • Post comments: Allow users to submit real-time comments on active live videos or streaming events.
  • Real-time delivery: Broadcast posted comments to all active viewers within 1 second.
  • Pinned comments: Enable hosts/moderators to pin selected comments to the top of the chat panel.
  • Reply threads: Support structured, short reply chains attached to individual comments.
  • Automated moderation: Filter profanity, detect spam bots, and enforce block lists dynamically.
  • Comment rate throttling: Implement adaptive sampling to handle viral streams without degrading UI performance.
  • Historical comments: Persist comments long-term, keeping them scrollable after live events conclude.

Incoming comments submit via WebSocket Gateways to the Comment Service (assigns Snowflake IDs and runs pre-filters). Approved comments write to Redis Pub/Sub which broadcasts them to WebSocket Gateways utilizing hierarchical fan-out. Async tasks process comments through Kafka and persist them globally inside a clustered Cassandra database.

Loading...