Design Zoom / WebRTC
Low-latency real-time video conferencing using WebRTC media gateways and SFU topologies.
1. System Requirements
- Support video/audio conferencing for up to 1,000 active group members.
- Dynamic video quality adjustment based on user bandwidth (ABR).
- Screen sharing and text chat overlays during conferencing.
- Ultra low latency audio/video routing (< 100ms packet latency).
- Minimal audio jitter and frame drop rates.
2. Scale & Resource Estimates
Throughput: 300 Million Daily Meeting Participants. Peak load = 100,000 active concurrent meetings.
Storage & RAM: Meeting logs and text chats: ~10 GB/day. Video recordings are saved on-demand.
3. System API Endpoints
POST /api/v1/meetings/create
Request: { host_id: "usr-904", title: "Engineering Sync" }
Response: { meeting_id: "mtg-abc-99", signaling_url: "wss://signaling.zoom.us/meet" }
4. Database Schema Design
Table: meetings (PostgreSQL)
- meeting_id (VARCHAR - Primary Key)
- host_id (UUID)
- active_status (BOOLEAN)
- created_at (TIMESTAMP)
Table: meeting_participants (Redis Cache - Key-Value)
- Key: meeting_members:{meeting_id}
- Value: Set of [user_id1, user_id2, ...]
5. Interactive High-Level Architecture
6. Scalability Deep Dive & Bottlenecks
Uses a Selective Forwarding Unit (SFU) media architecture. Unlike MCU (Multipoint Control Unit) architectures which decode and transcode video streams into a single composite view on the server, the SFU forwards individual raw media streams to all participants without processing them. This keeps CPU load minimal, enabling the media gateway to route streams to thousands of meeting participants in under 100ms.
7. Production Scaling Strategies
SFU Cascading: For meetings >100 participants, cascade multiple SFU servers in a tree topology. The origin SFU receives the speaker's stream and forwards to 5-10 leaf SFUs, each serving 50-100 participants. Total fan-out: 500+ participants with <200ms latency.
TURN/STUN NAT Traversal: Deploy TURN relay servers in 50+ global PoPs. When peer-to-peer WebRTC fails (symmetric NAT), traffic routes through the nearest TURN server. STUN handles 80% of connections directly; TURN handles the remaining 20% that require relay.
Regional Media Servers: Route participants to the nearest SFU based on GeoDNS. If a meeting has participants in US and EU, deploy SFU servers in both regions with a dedicated inter-region relay link (optimized peering, not public internet). Reduces cross-region latency by 40%.
Adaptive Video Quality: Each participant sends 3 video layers (simulcast): high (720p), medium (360p), low (180p). The SFU selects the appropriate layer per viewer based on their bandwidth and viewport size. Gallery view gets low-res; active speaker gets high-res.
Recording Pipeline: Recording service subscribes to the SFU as a silent participant. Receives all audio/video streams, muxes them into an MP4 via FFmpeg, and uploads to S3. For 1-hour meetings with 10 participants: ~2 GB raw, compressed to ~500 MB. Transcription via Whisper ASR runs async.
Breakout Rooms: Each breakout room is a separate SFU session. The control plane tracks room assignments and handles transfers between rooms. When a participant moves, their WebRTC connection is migrated to the new SFU via ICE restart — no full reconnection needed.
8. Runnable Production Starter Code
Scaffold