Library / Case Studies

Justin.tv's Live Video Broadcasting Architecture - High Scalability -

The future is live. The future is real-time. The future is now. That's the hype anyway. And as ...

By High Scalability engineers · High Scalability · Added 2026-10-12

Open original source

All content belongs to High Scalability engineers / High Scalability. We only link to it and give credit. Report a problem

Learn this case study

About 37 min left. Your work is saved as you go.

What you are about to study

High Scalability explains a real system. You should know the basics: caching, queues and replication.

Ideas you will meet

Distributed Systems
Consensus, time, failure and the fundamentals of scale-out.

What we already know about this

Our own lessons on these ideas. Read them here before you start, so it makes sense.

  • System Design Foundations · 11 minNetworking, APIs and CDNsWhat happens between a click and your server: DNS, HTTP, API styles, and how a CDN moves content closer to users.Read here

    The journey of a request

    Before your code runs, a lot happens. When a browser loads https://shop.example.com:

    Figure SDA-FND-09-1 · Request journey: DNS, CDN, origin · © forcsguy.com

    1. DNS turns the name into an IP address. Answers are cached at several levels for a time given by the record's TTL, so changes spread gradually.
    2. A connection is opened (TCP) and secured (TLS). Each step costs round trips, so long distances hurt.
    3. HTTP carries the request and response.

    Latency is mostly physics: a round trip across an ocean costs over 100 ms no matter how fast your code is. The only fixes are fewer round trips and moving data closer to the user.

    Optical fiber connections in network equipment: long distances are carried as light in glass fibersImage: Syced · CC0 · Source · Wikimedia Commons: Fujikura optic fiber at Science Museum

    Name lookup is a short chain of questions, each answered by a more specific server:

    Figure SDA-FND-09-2 · How a name becomes an address · © forcsguy.com

    A nineteenth-century map of the first transatlantic telegraph cable; today's internet still crosses oceans on undersea cables, which is why distance costs latencyImage: Howe's Adventures & Achievements of Americans · Public domain · Source · Wikimedia Commons: Transatlantic submarine cable map

    CDNs

    A content delivery network is a worldwide set of servers (edges) that keep copies of your content close to users.

    • Great for static files: images, video, scripts, stylesheets, and often whole pages that rarely change.
    • Cuts latency, absorbs traffic spikes and shields your origin from load.
    • Controlled by cache headers (Cache-Control: max-age=...) and purge APIs when content changes.
    • Use a versioned file name (app.3f9a.js) so you can cache for a year and still ship updates instantly.

    Figure SDA-FND-09-3 · Content delivery in tiers · © forcsguy.com

    Before: everyone goes to the origin

    After: a CDN serves copies near users

    What changed

    • Users get files from a nearby location
    • The origin handles far fewer requests
    • Changed files need invalidation or versioned names

    Choosing an API style

    StyleStrengthWatch out for
    REST over HTTP/JSONSimple, cacheable, universalOver-fetching, many round trips for complex screens
    GraphQLClient asks for exactly the fields it needsQuery cost control, caching is harder
    gRPCFast binary protocol, strong contractsNeeds tooling, awkward in browsers
    SOAPXML messages with a formal contract (WSDL) and built-in standards for security and transactions, still common in banks and older enterprise systemsVerbose, heavier tooling, rarely chosen for new public APIs
    WebSockets / SSEServer can push live updatesLong-lived connections need extra capacity and care

    A good default is REST for public APIs, gRPC between internal services if you need speed, and WebSockets only where live push is truly needed.

    Designing good APIs

    • Version them so old clients keep working.
    • Paginate list endpoints (cursor-based pagination stays stable as data changes).
    • Make writes idempotent with idempotency keys, so a retry does not double-charge.
    • Return clear errors with correct status codes.
    • Authenticate and rate limit at the edge, often in an API gateway that also handles routing, logging and TLS.

    Figure SDA-FND-09-4 · API gateway in front of services · © forcsguy.com

    More on this site

    Open this lesson with its quiz and exercise

Go deeper on this

A path through videos, articles, other case studies and code on the same ideas as Justin.tv's Live Video Broadcasting Architecture - High Scalability -.

  1. Warm upGet the vocabulary first.

  2. WatchHow others solve the same problem, on video.

    Videos belong to their creators and play from YouTube. More on YouTube (opens in a new tab)

  3. ReadEngineers explain it in their own words.

  4. See it in another companyThe same ideas, a different system.

  5. Read the codeSee how it looks when it is real.

Keep learning

Loading community…