Design Live Video Conferencing (Zoom / Meet)
Keep calls under 150ms with WebRTC signaling, ICE/STUN/TURN traversal, SFU routing, simulcast bitrates, and regional SFU cascading.
In this lesson (4 bite-sized sections)
Why live calls break VOD and TCP
On-demand video platforms like YouTube buffer 5 to 15 seconds of HLS segments over TCP so playback never stutters. Live video conferencing (Zoom, Google Meet) flips that priority: humans start talking over one another once mouth-to-ear latency crosses ~250ms, so the engineering target sits under 150ms.
Running real-time media over TCP fails immediately because one lost packet stalls every newer frame behind head-of-line blocking until retransmission completes. WebRTC instead runs media over UDP wrapped in SRTP (Secure Real-time Transport Protocol), paired with RTCP feedback. If one video packet vanishes on bad Wi-Fi, the receiver repairs it via Forward Error Correction (FEC), asks for a fast NACK retry if time allows, or drops the frame and requests a keyframe rather than freezing the conversation.
Signaling and NAT traversal (ICE, STUN, TURN)
WebRTC defines media transport, not how participants find each other. A signaling service (typically WebSockets over TLS) manages rooms, authentication, and exchanging SDP (Session Description Protocol) offers/answers listing codecs and media tracks, plus network candidates.
Because most laptops sit behind home NAT routers and corporate firewalls, ICE (Interactive Connectivity Establishment) probes three candidate classes to open a UDP path:
- Host candidates: local LAN IP addresses (works when callers share an office network).
- STUN (Server-Reflexive) candidates: a lightweight echo server tells the client its public NAT IP and mapped port so both sides can punch a direct UDP hole.
- TURN (Relayed) candidates: a media relay server with a public IP that forwards encrypted media packets when direct hole-punching fails.
Mesh vs MCU vs SFU topologies
Once a call grows past three participants, the media topology determines both client uplink limits and server compute bills:
| Topology | Client Uplink | Server CPU | Added Latency | Sweet Spot |
|---|---|---|---|---|
| P2P Mesh | O(N) streams per caller | Zero | Lowest (direct hop) | 2 to 4 callers |
| MCU (Mixer) | 1 stream | Very high (decode + re-encode) | Higher (+30 to 80ms) | Legacy SIP / tiny low-power clients |
| SFU (Router) | 1 stream (or 2-3 simulcast) | Very low (packet forwarding) | Minimal (< 10ms) | Modern 5 to 100+ person rooms |
In a P2P Mesh, every participant encrypts and uploads a separate copy to N - 1 peers, saturating home uplink around 4 to 6 callers. An MCU (Multipoint Control Unit) decodes every stream, composites one tiled grid, and re-encodes it, burning massive server CPU and adding frame latency. An SFU (Selective Forwarding Unit) receives one upload per sender and inspects unencrypted RTP headers to forward packets selectively without touching video pixels, keeping server CPU tiny and letting each client arrange its own layout.
Simulcast, SVC, and regional SFU cascading
In a 30-person SFU room, one participant on congested hotel Wi-Fi must not force everyone else down to blurry video. With Simulcast, each publisher encodes 2 to 3 resolution layers (for example 180p, 360p, and 720p) concurrently; with SVC (Scalable Video Coding in VP9 or AV1), base and enhancement layers pack into one bitstream. Guided by receiver congestion reports (TWCC), the SFU forwards 720p only for the active speaker, 180p thumbnails for gallery tiles, and drops upper layers instantly for congested receivers while keeping audio prioritized.
For global calls, never route 20 London attendees individually across the Atlantic to a California SFU. Use regional SFU cascading: connect callers to their nearest regional SFU (low first-hop RTT for jitter recovery), and bridge only active tracks once over a private inter-region backbone between SFUs.
Global WebRTC architecture with regional SFU cascading: an architecture diagram of 6 components and 6 connections. Full description follows.
- US Callers: client.
- EU Callers: client.
- Signaling + Room State: service.
- Regional STUN / TURN: load balancer.
- SFU Cluster (US): service.
- SFU Cluster (EU): service.
- US Callers calls synchronously Signaling + Room State (SDP / ICE).
- EU Callers calls synchronously Signaling + Room State (SDP / ICE).
- US Callers sends asynchronously to SFU Cluster (US) (SRTP simulcast).
- EU Callers sends asynchronously to Regional STUN / TURN (firewall fallback).
- Regional STUN / TURN sends asynchronously to SFU Cluster (EU) (relayed SRTP).
- SFU Cluster (US) replicates to SFU Cluster (EU) (cascaded active tracks).
Sources: RFC 8445, ICE NAT traversal · RFC 8825, WebRTC overview · WebRTC for the Curious · LiveKit SFU architecture
Apply
Your turn
The task this lesson builds to.
Architect a Zoom-style live video conferencing service supporting 100-participant meetings globally with sub-150ms glass-to-glass audio latency and mixed network qualities.
Think about
- How do signaling, ICE, STUN, and TURN cooperate to get UDP media through home routers and corporate firewalls?
- Why does an SFU with simulcast or SVC beat both P2P mesh and a transcoding MCU?
- How does regional SFU cascading keep cross-continent meetings fast and cheap?
Draft your design answer here Save your draft, compare against the model answer, and track progress.
Practice
Make it stick
A second problem on the same idea, so it survives past today.
Propose how to add true end-to-end encryption (E2EE) to an SFU-based 50-person video meeting using WebRTC Insertable Streams without breaking server-side active-speaker switching or simulcast layer selection.
Think about
- Why does standard DTLS-SRTP terminate at the SFU rather than end-to-end?
- Which RTP headers must remain readable to the SFU while encoded frame payloads stay encrypted?
- How do clients distribute and ratchet the shared meeting key when a participant joins or leaves?
Draft your design answer here Save your draft, compare against the model answer, and track progress.