Design Chat Fan-Out for a Channel With a Million Viewers
Last updated: November 29, 2026
Quick Overview
Design the real-time chat system for Twitch so that a single channel with over a million concurrent viewers can send and receive messages with low latency, while moderation actions (deletes, bans, timeouts) take effect quickly for everyone.
Twitch
November 29, 20260
0
0 solved
Design the real-time chat system for Twitch so that a single channel with over a million concurrent viewers can send and receive messages with low latency, while moderation actions (deletes, bans, timeouts) take effect quickly for everyone.
Chat is one of Twitch's defining systems: billions of messages a day with extreme skew, where one esports channel can dwarf thousands of small ones combined. The interviewer is probing fan-out math, connection management, hot partition handling, and what you degrade when a channel is too hot to deliver every message to everyone.
What the Interviewer Expects
- Separates connection edges from channel routing and message processing
- Does the fan-out math explicitly (messages per second times viewers)
- Handles hot channels with hierarchical fan-out and sampling
- Puts moderation and AutoMod in the send path with a clear latency budget
- Explains reconnect storms and backpressure
- Keeps ordering guarantees per channel, not global
Key Topics to Cover
How to Approach This
- Start by clarifying functional and non-functional requirements with the interviewer.
- Estimate the scale: QPS, storage, bandwidth. This drives your design decisions.
- Draw a high-level architecture first, then deep dive into 1-2 critical components.
- Discuss trade-offs explicitly (e.g., consistency vs availability, SQL vs NoSQL).
- Address failure scenarios, monitoring, and how the system handles 10x traffic spikes.
Possible Follow-up Questions
- The channel jumps from 50k to 1.5M viewers in two minutes during a tournament. What happens?
- How do message deletes reach clients that already rendered the message?
- Would you ever drop messages on purpose? Which ones?
- How do you deploy a new edge build without dropping a million sockets?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice System Design ProblemsSample Answer
Requirements
Functional: join a channel, send and receive messages, emotes, badges, mod actions (delete, timeout, ban, clear), slow mode and similar. Non-functional: p99 delivery under about one second, ordering w...
High-Level Design
Clients hold WebSockets to stateless edge servers in many regions (an IRC-like protocol). Sends go edge to an ingest service that authenticates, applies rate limits and channel settings, runs AutoMod,...