System design interview guide
Twitch System Design Interview: Live Video Ingest, Transcode, and Chat at Scale
Two courses by the author of this page:
770 lessons · 18 free to read
₹1,111 in India · $35 elsewhere, once
Get System DesignYou own this course
219 lessons · 10 free to read
₹1,333 in India · $35 elsewhere, once
Get Generative AI and Agentic AIYou own this course
Save your progress and get the interview checklist PDF
Twitch runs tens of thousands of concurrent live channels at once, with peaks reported in the range of 6 million concurrent viewers watching more than 70,000 live streams (industry estimates, not an official real-time figure). Every one of those broadcasters pushes a single high quality RTMP stream that has to be transcoded into a full bitrate ladder and fanned out to viewers within a couple of seconds. The chat side is its own beast: Twitch has said its chat delivers hundreds of billions of messages per day.
Twitch is a live video platform, which makes it a very different design problem from Netflix or YouTube VOD. A broadcaster pushes one live RTMP stream, and Twitch has to accept it at a nearby point of presence, route it to an origin, transcode it into multiple renditions in real time, package it as HLS segments, and push those segments through a CDN to potentially millions of viewers, all while keeping glass-to-glass latency in the low single digit seconds. On top of that sits a real-time chat system that has to deliver a firehose of messages per channel with strict ordering and moderation. The hardest parts are the transcode fleet economics, the thundering herd when a huge streamer goes live and every viewer requests the first segment at once, keeping live latency low without breaking CDN cacheability, and building a chat fanout tier that can hold tens of millions of persistent connections. Twitch built custom systems for most of this, including Intelligest for ingest routing and a purpose built transcoder, and a Go based chat edge and pubsub layer. A good interview answer separates the video plane from the chat plane and treats them as two independent scaling problems that happen to share a channel identity.
Where it shows up
Asked at Amazon (which owns Twitch), YouTube, Meta, and most companies that run live video or real-time messaging. It also shows up at streaming startups and any interview loop that wants to probe live media, CDN behavior, and websocket fanout.
Spec sheetTwitch
- 01Concurrent broadcasts
- ~70,000 to 100,000 live channels at peak
- 02Transcode compute per stream
- ~4 to 6 CPU cores for a 1080p60 ladder
- 03Peak concurrent viewers
- ~6 million+
- 04Chat messages per day
- Hundreds of billions
worked through below, with the maths
in this guide
Design Twitch, part by part
7 parts open to everyone · 3 with a free account · 3 with the course
You can read 7 of 13 parts. A free account opens the deep dive; the course opens all of it.
- Requirementsopen
- Scale estimatesopen
- High-level architectureopen
- Core componentsopen
- Data modelfree account
- Deep dives (7)free account
- Trade-offs to discussfree account
- What the interviewer asks nextwith the course
- The interview scorecardwith the course
- Mock interview on this questionwith the course
- How Twitch actually does itopen
- Frequently asked questionsopen
- Interview readiness checkopen
The hard parts of this design are taught step by step in the System Design course: Cache Stampede Prevention, WebSockets and Streaming Protocols.
Why this question is asked
Interviewers like this problem because live video breaks a lot of the assumptions candidates lean on. You cannot pre-encode and cache everything like VOD, so the transcode fleet is on the critical path and its cost model matters. Latency is a hard constraint that fights directly with CDN cacheability, so the candidate has to reason about that tension instead of hand waving. It also has two very different real-time subsystems, video and chat, which tests whether someone can decompose a product into independent planes rather than one monolith. Finally, the thundering herd on a popular stream is a clean, concrete way to see if a candidate understands caching, request coalescing, and origin protection.
This page is the free part.
The course goes deeper on the Twitch design
₹1,111 in India$35 everywhere elseonce, for the whole course
The System Design course covers the Twitch design across a run of lessons, not one page. These 4 alone are about 90 minutes of step-by-step reading, every one with a quiz.
- Content Delivery Network (CDN)
A CDN is thousands of caches you do not operate, and the cache key decides everything about whether it helps you.
- Edge Caching
The same 200 URLs became 200, 501, 7,628 or 18,404 cache entries under four values of one response header, and the origin went from 200 requests to 18,706.
- Cache Stampede Prevention
A cache stampede is many requests rebuilding expired keys at once. Single flight and TTL jitter, measured on one run: what each fixes and what it does not.
- Latency
Time delay in system response - most basic performance metric.
all part of
System Design Masterclass
770 lessons · about 290 hours · 18 free to read
₹1,111in India, by UPI
$35everywhere else, by card or PayPal
You own this course
Continue with Content Delivery Network (CDN)pay once,
yours for life
Live from the course bench
Before you design Twitch, try the questions it rests on.
Real interview questions, live diagrams and measured lab results, pulled at random from the lessons. A new set every time you come back.
Requirements
Always clarify these in the first 5 minutes of the interview. Do not start drawing boxes until both lists are agreed.
Functional requirements
- Let a broadcaster push a single live stream over RTMP (or newer protocols) from encoding software like OBS.
- Transcode the ingest stream into a bitrate ladder (for example 1080p60, 720p, 480p, 360p, 160p) plus a source passthrough rendition.
- Package renditions as HLS (and DASH) segments with a manifest so any player can adapt bitrate to its bandwidth.
- Deliver segments to millions of concurrent viewers through a CDN with the lowest practical latency.
- Provide per-channel chat where any viewer can post messages that all other viewers in the channel see in near real time.
- Support moderation: bans, timeouts, slow mode, subscriber-only mode, and automated filtering before messages are delivered.
- Record the live stream to VOD so it can be replayed after the broadcast ends.
- Show near real-time viewer counts, follows, subscriptions, and channel metadata.
- Support clips, where a viewer captures a short segment of a live or recorded stream.
Non-functional requirements
- Glass-to-glass latency in the low single digit seconds for the low latency profile, ideally 2 to 4 seconds.
- High availability for ingest and playback; a viewer should never see the platform hard-fail even if one origin dies.
- Elastic transcode capacity that scales with the number of concurrent broadcasts, which is spiky and event-driven.
- Chat message delivery within a few hundred milliseconds and correct per-channel ordering.
- Global reach with points of presence close to both broadcasters and viewers to cut network latency.
- Cost efficiency on transcode, since each stream consumes several CPU cores continuously while live.
- Graceful degradation: if the highest rendition cannot be produced, viewers still get source or a lower rendition.
Back-of-envelope scale estimates
Show your math. Pulling numbers from thin air signals you have not thought about the load.
Concurrent broadcasts
~70,000 to 100,000 live channels at peak
Public trackers report Twitch regularly running tens of thousands of live channels. Each live channel is an independent ingest plus transcode pipeline, so this number, not viewer count, drives transcode fleet size. Estimate.
Transcode compute per stream
~4 to 6 CPU cores for a 1080p60 ladder
Real-time transcode of a 1080p60 source into a five rung ladder is roughly 4 to 6 cores per stream on general purpose CPUs. At 70,000 concurrent streams that is on the order of 300,000 to 420,000 cores of transcode capacity. Derived estimate; Twitch offloads much of this to custom hardware and FPGAs.
Peak concurrent viewers
~6 million+
Widely cited peak figure across popular events. Viewers are served almost entirely from CDN edge, so this scales with edge fleet and cache hit ratio rather than origin. Estimate, not an official real-time metric.
Chat messages per day
Hundreds of billions
Twitch has publicly described chat delivering hundreds of billions of messages per day. Delivery, not ingestion, is the load: one message in a channel with 1 million viewers is 1 million deliveries, so fanout dominates.
Video egress bandwidth
Multiple Tbps at peak
6 million viewers at an average sustained bitrate near 3 Mbps is about 18 Tbps of egress (6e6 * 3e6 bits/s). Real average is lower because many watch sub-1080p renditions, but it lands in the multi-Tbps range served by CDN edge. Derived estimate.
Segment size and manifest churn
2 second segments, manifest refreshed every ~2s
HLS chops each rendition into short segments (2 seconds for low latency). A one hour VOD at 2 second segments is 1,800 segments per rendition, times roughly six renditions equals about 10,800 objects per hour per channel to store. Derived.
High-level architecture
A broadcaster's encoder opens an RTMP connection to the nearest Twitch point of presence, not directly to a data center. At the PoP, an ingest gateway (Twitch calls its system Intelligest) terminates the RTMP stream, inspects its properties, and asks a routing service where to send it. The routing service picks an origin data center based on capacity, health, and locality, and the media proxy forwards the stream there. At the origin, a transcode fleet decodes the source and re-encodes it into a ladder of renditions at different resolutions and bitrates, then a packager cuts each rendition into short HLS segments and writes a manifest. Those segments are pushed out to the CDN. Viewers never hit the origin directly: their player fetches the manifest and segments from a nearby edge server, which caches each segment for a short window so that thousands of viewers of the same channel are served from one cached copy. Adaptive bitrate logic in the player watches its download speed and switches renditions up or down. In parallel, and completely independent of the video path, the chat system runs its own edge tier that holds each viewer's persistent connection (IRC over TCP or WebSocket); a message posted in a channel goes to an edge node, through a pubsub layer that fans it out to every other edge node holding a connection for that channel, after passing moderation checks. When the broadcast ends, the recorded segments are stitched into a VOD asset in object storage for later replay.
In a real interview, sketch this on the whiteboard before diving into any single box.
Core components
Walk through each service. The interviewer wants to hear what each one owns, not just the names.
Ingest gateway (Intelligest media proxy)
Runs at each PoP and is the first Twitch component the broadcaster's RTMP stream touches. It terminates the live stream, extracts stream properties, and forwards media to the chosen origin. Terminating at the edge keeps the fragile broadcaster connection short and lets Twitch make smart routing decisions before committing to a data center.
Ingest routing service
A stateful control plane service (Twitch runs its IRS in AWS) that decides which origin each incoming stream should go to. It uses capacity, health, and rule-based policies so that compute is packed efficiently and a failing origin can be steered around. This is what lets Twitch drive its transcode fleet near full utilization at peak.
Transcode fleet
At the origin, this fleet decodes the single source stream and re-encodes it into multiple renditions in real time. Twitch built a purpose designed transcoder rather than relying only on stock FFmpeg because per-stream cost is the dominant economic factor at their scale. Each active stream consumes several cores continuously, so this fleet is the most expensive part of the system.
Packager and origin
Takes encoded renditions and cuts them into short HLS and DASH segments, writes and continuously updates the manifest, and serves as the authoritative source the CDN pulls from. It also writes segments to storage for VOD. The origin is protected from viewer load by the CDN in front of it.
CDN and edge cache
A large fleet of edge servers close to viewers that cache each segment for a short window (tens of seconds) and serve it to every local viewer of that channel. This is what makes one million viewers of a stream affordable: the origin produces each segment once and the edge multiplies it. Cache hit ratio at the edge is the single biggest lever on cost and origin protection.
Chat edge tier
A fleet of Go services that hold each viewer's persistent connection over IRC-style TCP or WebSocket. It handles connect, join, and message send, and delivers messages down to connected clients. It is the tier that has to survive holding tens of millions of open sockets, so it is designed to be horizontally sharded and stateless beyond the connections it owns.
Chat pubsub and moderation pipeline
An internal pubsub layer fans a message out from the edge node that received it to every edge node that has a subscriber for that channel, forming a hierarchical distribution tree that keeps per-message work low. Before delivery, a business-logic pipeline (Twitch calls its component Clue) applies checks like ban status, subscriber-only mode, and slow mode, and automated moderation filters the message.
Data model
channels. One row per broadcaster channel. The stream_key authenticates the RTMP push and must be revocable. is_live plus current origin location is updated when a broadcast…
Every table for Twitch, its keys, and which store fits it and why.
Deep dives
Ingest routing and why it is not just a load balancer. The naive design points broadcasters at a data center behind a generic load balancer like HAProxy. Twitch moved away from that because a live video stream is long-lived…
7 deep dives on the parts that break at scale: Ingest routing and why it is not just a load balancer; Real-time transcoding and the bitrate ladder; HLS delivery, segment caching, and the latency versus cacheability tension.
Trade-offs to discuss
Custom ingest routing (Intelligest) versus a generic load balancer. A generic layer 4 or 7 balancer treats connections as interchangeable, but live streams are long-lived and expensive to place, so Twitch built a stateful router that…
6 decisions an interviewer expects you to defend, each with the alternative and why it loses here.
What the interviewer asks next
The origin transcoding a popular stream fails in the middle of the broadcast. What happens?
4 follow-up questions with model answers, the interview scorecard for this question, and a mock interview on Design Twitch with the AI tutor.
How Twitch actually does it
Twitch has been unusually open about its architecture. The company documented Intelligest, its ingest routing system that terminates RTMP at PoPs and routes to origins via a stateful routing service, in its 2022 engineering post on ingesting live video at global scale, noting it replaced HAProxy and lets them approach full transcode utilization at peak. Its 2021 post on low latency, high reach describes bringing latency from around 15 seconds down to a 2 to 4 second low latency profile using a custom low latency HLS approach with future-segment URLs and blocking requests. Its 2017 transcoding series explains why they built a custom transcoder instead of relying on stock FFmpeg, driven by per-stream cost. On the chat side, Twitch has described a Go-based system with an Edge tier speaking IRC over TCP and WebSocket, a Pubsub tier that performs hierarchical fanout, and a business-logic component (Clue) for checks like bans and subscriptions, delivering hundreds of billions of messages per day. These are real systems described by Twitch itself, and a strong candidate cites the split between the cacheable HTTP video plane and the persistent-connection chat plane as the central architectural decision.
Sources
- Twitch Blog: Ingesting Live Video Streams at Global Scale (Intelligest, 2022)
- Twitch Blog: Low Latency, High Reach (2021)
- Twitch Blog: Live Video Transmuxing/Transcoding, FFmpeg vs TwitchTranscoder (2017)
- Twitch Blog: Twitch Engineering, An Introduction and Overview (chat, 2015)
- Twitch Blog: State of Engineering 2023
Lessons to study before this interview
If any of these topics are fuzzy, the interviewer will catch it. Each lesson is 15 to 60 minutes with diagrams, code, and a quiz.
System design interviews at companies in the US, UK, Canada and Singapore
41 walkthroughs of real systems at well-known companies, each built from that company's own engineering blog, talks or filings, with the numbers cited.
Banking, payments and trading
Commerce and delivery
Rides and maps
- Grab system design (Singapore)
- Uber system design
Feeds, social and messaging
Streaming and media
- Netflix system design
- YouTube system design
- Spotify system design
- Twitch system design (this page)
- TikTok system design
AI labs and big tech
Developer and collaboration tools
Frequently asked questions
interview readiness
Are you ready for Design Twitch?
Three questions from this guide. Answer them without scrolling up, the way you would have to in the room.
Go deeper
This guide is built on these 5 lessons. Each one teaches one piece of the Twitch design above, step by step.
- Content Delivery Network (CDN)System Design · load balancing proxies · 26 min
- Edge CachingSystem Design · caching strategies · 25 min
- Cache Stampede PreventionSystem Design · caching strategies · 25 min
- LatencySystem Design · core fundamentals · 14 minFree
- Horizontal ScalingSystem Design · core fundamentals · 32 min
Practice with 770 system design lessons
Lifetime access for ₹1,111 in India or $35 elsewhere. Interactive diagrams, quizzes, and 20 capstone projects to practise on.
This one question is not enough for the interview.
Get all 200 questions in the System Design and Distributed Systems pack
Each question has why it is asked, a full answer, what the interviewer listens for, the follow-ups, the common mistakes and a diagram (268 diagrams in all). A PDF you keep, junior to staff level.
Pay by UPI, cards or netbanking through Razorpay. Pay by card or PayPal, in US dollars. Download at once from My packs.
NEWSystem Design Hands-On
Included in the System Design course: real systems, built live
Postgres Sharding: Complete Hands-On (PgBouncer + Citus). 2 h 36 min and 20 chapters: one PostgreSQL loaded until it breaks, then four shards behind a router you write, PgBouncer and Citus, with the 139-page slide deck. The first 15 minutes are free to watch.


