Practice/Oracle/Design Meta Live Comments
Design Meta Live Comments
System DesignMust
Problem Statement
Design a real-time commenting system that allows users to view and post comments instantly while watching live videos or browsing posts. The system should handle massive-scale traffic and support features like reactions, live notifications, and seamless user transitions between different content streams.
The core challenge is designing low-latency fanout at massive scale, reasoning about hot-spot contention on a single stream, and handling unreliable mobile clients that disconnect, background, and switch streams rapidly. Strong answers connect product needs (smooth scrolling, no gaps or duplicates, graceful degradation) to the right architectural patterns: pub/sub, cursors, replay buffers, backpressure, and client-side strategies.
Key Requirements
Functional
- Post comments -- users can post comments and reactions to an ongoing live video or content stream in real time
- Real-time delivery -- new comments appear on all connected clients without manual refresh, streaming in sub-second
- Catch-up on join -- users joining a stream see recent comments from before they connected to get context
- Stream switching -- users can switch between live videos and immediately see only the relevant comments without gaps or duplicates
Non-Functional
- Scalability -- support millions of concurrent viewers across thousands of simultaneous live streams with extreme skew on popular streams
- Reliability -- handle mobile client disconnects and reconnects gracefully without losing comments or showing duplicates
- Latency -- propagate new comments to all viewers within 500ms under normal conditions
- Consistency -- eventual consistency is acceptable; all viewers should converge to the same comment timeline
What Interviewers Focus On
Based on real interview experiences, these are the areas interviewers probe most deeply:
1. Real-Time Fan-Out at Scale
Interviewers want to see how you'll deliver comments to millions of viewers on a single hot stream without overwhelming servers or creating bottlenecks.
Hints to consider:
- Use a pub/sub system keyed by stream ID to route comments only to interested subscribers
- Co-locate viewers of the same stream on the same WebSocket servers to minimize cross-server fan-out
- Implement tiered fan-out: comments go to a message broker, then to edge servers, then to connected clients
- Apply backpressure and sampling for extremely hot streams where comment volume exceeds what users can read
2. Client Reconnection and Catch-Up
Mobile clients frequently disconnect due to network changes, app backgrounding, or stream switching. Interviewers probe how you maintain a coherent experience across these disruptions.
Hints to consider:
- Assign sequence numbers to each comment so clients can detect gaps and request retransmissions
- Maintain a bounded replay buffer per stream (e.g., last 5 minutes) for fast catch-up on reconnect
- Send the client's last-seen sequence number on reconnect to stream only missing comments
- Handle deduplication on the client side using comment IDs to prevent duplicates during reconnection
3. Hot-Stream Contention
A single celebrity live stream can attract millions of viewers and thousands of comments per second, creating extreme contention on a single key.
Hints to consider:
- Shard the fan-out for hot streams across multiple broker partitions or pub/sub channels
- Use consistent hashing to distribute viewers across multiple WebSocket servers while keeping stream affinity
- Implement comment rate limiting and moderation queues to manage comment volume on popular streams
- Consider viewer-side sampling where not every comment is shown if the volume exceeds readable rates
4. Comment Persistence and Ordering
Interviewers look for how you balance real-time delivery speed with durable storage and consistent ordering.
Hints to consider:
- Write comments to a durable append-only log (Kafka) for persistence and replay capability
- Use server-assigned timestamps or sequence numbers for canonical ordering across distributed servers
- Store comments in a database asynchronously from the real-time delivery path to avoid blocking
- Design the read path to merge real-time streaming comments with persisted history for users who scroll back