# Live streaming - latency against the buffer that saves you

> Why segment length sets latency, resilience and cost at once, and what each second removed costs. The board buys 8 seconds of glass-to-glass latency with a…

Source: https://tierslate.com/templates/live-streaming

Video & media · System design · deep · 11 step walkthrough · 5 tables

Why segment length sets latency, resilience and cost at once, and what each second removed costs.

**Own this board: 800 credits.** The first act plays on the page. Owned once with credits, never a subscription.

## What this board gets wrong on purpose

The tension: The board buys 8 seconds of glass-to-glass latency with a rolling window of three 2-second segments, and those two facts are the same fact: the player is three segments behind live BY CONSTRUCTION, and those three segments are also the entire cushion it has when a Wi-Fi router stutters. Halving the segment length halves both. Chat arrives over a websocket in 200 milliseconds, so every viewer learns about the goal from the chat window seconds before they see it - and the 2-second choice also writes 125,000 objects a second across the platform, which is 54,000 dollars a day in PUT requests alone, before a single byte is stored. Going to 200 ms chunks to fix the chat problem multiplies that by ten and removes the cushion entirely.

## Practise this as an interview

Take Live streaming - latency against the buffer that saves you as a timed system design interview on a blank board - on your own, with the requirements to check yourself against, or with a candidate you invite.

## Start here

### Why this design

Live streaming is the system with no retry: a lost second is gone, and the only protection is a buffer somebody is already holding. Interviewers use it to see whether you can trace glass-to-glass latency hop by hop, explain why one segment serves a million viewers only while every viewer requests the identical URL, and size a transcode fleet that must run in real time with no queue to hide in. Every live video platform and sports broadcaster tunes the same dial this board is built around: segment length.

### What you will learn

- Why**segment length sets latency, resilience and cost at once**: 2 s segments in a 3-segment window give**~8 s glass-to-glass**and exactly three segments of cushion.
- How the edge absorbs the audience:**1.5M requests/s**at the edge, half of them manifests, against**~5,000 origin fetches/s**whatever the audience size.
- Why live transcode is sized for the worst minute of the year:**375,000 cores**for 50,000 channels x 5 rungs, and a rung at 1.05x real time never catches up.
- The cost nobody budgets:**125,000 object PUTs/s, ~$19.7M/year**, and ten times that at 200 ms LL-HLS parts.
- Why the broadcaster pushes to**two ingest POPs**, and why deploys drain by channel and never cut a live broadcast.
- Why chat at**200 ms**spoils the goal, and the two honest fixes.

### How to read this board

1. Press play once: the walkthrough follows one broadcast from the camera to the eye, then to the chat and the money.
2. **CONTRIBUTION - THE FIRST TWO SECONDS, ALREADY SPENT**(top left): the encoder, the keyframe interval and the redundant push.
3. **INGEST AND REAL-TIME TRANSCODE**, then**PACKAGE - SEGMENT LENGTH IS THE DIAL**: the top row, left to right.
4. **DELIVERY - AND THE TRIP BACK TO A HUMAN**: the second row, right to left - shield, edge, player, viewer, chat. The distance around that loop is the latency.
5. **THE RECORDING**: the DVR window and the replay, kept off the live path.
6. **DATA MODEL - WHAT GENERATE SQL READS**:`segments`explains the money;`channels.latency_mode`is the rollback dial.
7. Then pages 1 to 6 in order: requirements, capacity, storage, availability, how it works, deployment.

## 1 · Requirements

Live is not video-on-demand with a shorter deadline. It is a different system, because the thing every other design leans on - the ability to fetch a byte again - does not exist. A second that is lost is gone.

### Functional

- A broadcaster pushes one stream over RTMP or SRT and it is playable worldwide within seconds.
- The stream is transcoded to a ladder in real time, so viewers on poor connections are not excluded from a live event.
- A viewer joining halfway in starts at the live edge, not at the start.
- Chat and stream events are delivered alongside the video.
- The broadcast is recorded: a rolling DVR window during the event, and a permanent replay afterwards.
- A broadcaster can see, live, whether their own upstream is the problem.

### Non-functional

- Glass-to-glass latency target of 8 seconds in standard mode, 3 seconds in low-latency mode. It is a target, not a guarantee, and the difference is the point of this board.
- Rebuffer ratio under 0.5 percent - a looser target than video-on-demand, because there is no buffer to hide behind.
- Ingest availability 99.99 percent during a broadcast. A dropped ingest is not a degraded experience, it is the event ending.
- One segment must serve a million viewers. Any per-viewer element in a manifest or URL breaks that and is treated as an outage, not a feature.
- No single-segment loss may stall playback: a missing rung falls back to a lower one within one segment.

### Questions to ask before designing this

- What is the latency REQUIREMENT, in the product sense? Betting and auctions need under 2 seconds. A concert needs 10 and would rather never stutter. These are two different systems and the answer changes every box on the diagram.
- How many concurrent channels, and how peaked? 50,000 channels at 4 hours each is a fleet-sizing problem; one channel with 20 million viewers is a fan-out problem. They are not the same build.
- Is chat in scope? If yes, the spoiler problem is in scope, and either chat must be delayed to match video or video must be dragged down to match chat.
- Is DVR required during the broadcast, or only a replay afterwards? Seek-during-live turns a rolling window of three segments into a full manifest of thousands and changes the cache behaviour completely.
- What upstream do broadcasters actually have? Designing for 6 Mbps when the median is 2 means the ladder starts below where you thought.
- Who pays for the egress - the platform or the broadcaster? That answer decides whether the top rung exists.

## The rest of this board

This page publishes the question. The answer - 5 more written pages, an 11-step narrated walkthrough and a 5-table schema - is the board itself, and it opens in Tierslate.

- 5 written pages
- 11 walkthrough steps
- 5 tables (31 columns)

5 pages behind this one:

- Capacity estimation
- Storage estimation
- Availability
- How it works
- Deployment plan

## Related system design templates

- [Image CDN system design](https://tierslate.com/templates/image-cdn) - Why the cache key is the design, and why egress and the long tail of misses set the bill, not CPU.
- [Streaming playback system design](https://tierslate.com/templates/netflix-streaming) - Why streaming is a bandwidth problem, solved by placing the bytes inside the network before anyone asks.
- [Transcoding pipeline system design](https://tierslate.com/templates/video-transcoding) - Why one number, the size of a segment, sets the cost, latency and failure behaviour of the whole pipeline.
- [Video upload system design](https://tierslate.com/templates/youtube-upload) - Why a durable receipt for a 500 MB upload and a video that plays everywhere are two separate promises.
- [File upload system design](https://tierslate.com/templates/file-upload) - How presigned URLs send uploads straight to object storage, and what the server still has to check afterwards.
- [Music streaming system design](https://tierslate.com/templates/music-streaming) - Why audio is small enough to prefetch, and why play counts and royalties are the hard ledger underneath.
- [Short video feed system design](https://tierslate.com/templates/short-video-feed) - Why a short-video feed is ranking plus prefetch, and why the first second of video decides retention and cost.
- [Video calls system design](https://tierslate.com/templates/video-conferencing) - Why a group call forwards streams through an SFU, and how bandwidth estimation keeps a bad link from ruining the call.

All 100 system design templates: https://tierslate.com/templates (Markdown: https://tierslate.com/templates.md)
