Design a live-stream comments system
Company: Microsoft
Role: Software Engineer
Category: System Design
Difficulty: hard
Interview Round: Technical Screen
## System Design: Live-stream comments (YouTube Live-style)
Design a system that supports real-time comments for live video streams.
### Core features
- Users can post comments to a specific live stream.
- Viewers of that stream see new comments appear in near real time.
- The system must handle “hot” streams with very high QPS (orders of magnitude larger than normal streams).
### Requirements to clarify
- Latency target (e.g., p95 end-to-end publish → visible under 500 ms).
- Ordering expectations (strict total order vs best-effort vs per-user ordering).
- Fanout scale (viewers per stream), and whether all viewers must see all comments.
- Moderation features (spam detection, toxic content filtering, blocklists, slow mode).
- Retention/replay (store comments for VOD playback and auditing).
### Deliverables
- High-level architecture and major components.
- Data model and APIs.
- How you scale ingestion and fanout, especially for hot streams.
- Justify the choice of streaming/messaging tech (e.g., Kafka vs other MQ/pubsub options).
- Backpressure, rate limiting, and failure handling.
Quick Answer: This question evaluates design skills for scalable, low-latency real-time comment systems, covering architecture, data modeling, APIs, ingestion and fanout strategies, streaming/messaging trade-offs, and operational concerns such as rate limiting, backpressure, and failure handling.