RETURN TO SYSTEM DESIGN VAULT (55)BLUEPRINT #48 // Hard
#48HardReal-Time & Stream Processing
Design a Live Comments Feature for Facebook
ASKED IN INTERVIEWS AT:Meta
EXECUTIVE SUMMARY & PROBLEM STATEMENT
Design a real-time live streaming comments engine delivering thousands of concurrent viewer comments to millions of viewers during live broadcasts with zero lag.
SCALE ESTIMATION & TRAFFIC ENVELOPE
DAILY ACTIVE USERS / TPS5 Million viewers on a single live event, 20,000 comments/sec peak
READ / WRITE TRAFFIC RATIOMassive 1:N fan-out
5-YEAR STORAGE CAPACITYRedis Pub/Sub transient channels + async DB batching
FUNCTIONAL REQUIREMENTS
- [1]Post live comment on video stream
- [2]Broadcast new comments to all active stream viewers in real time
- [3]Filter spam and offensive language
NON-FUNCTIONAL REQUIREMENTS
- •Comment broadcast latency < 1 second
- •Survive 5 Million concurrent viewers on celebrity streams
- •Graceful client-side degradation during comment floods
CORE ARCHITECTURAL COMPONENTS
Comment Ingestion Gateway
Automated Content Safety Filter
Hierarchical Redis/Kafka PubSub Tree
Edge WebSocket Terminating Nodes
Client Comment Sampler
DATA SCHEMA & PERSISTENCE
LiveComments: comment_id, stream_id, user_id, text, timestamp
DISTRIBUTED TRADE-OFFS & FAILURE MODES
- ⟡During massive surges (>1,000 comments/sec), the server samples and sends top 100 comments/sec to prevent crashing mobile rendering threads.