System design interview: design a video conferencing service
A video conferencing system lets a group of people send live audio and video to each other with a delay short enough to hold a conversation. The interview turns on three choices: how media travels between participants (mesh, SFU or MCU), how you adapt each stream to each receiver's network, and how you keep a call alive when a media server or a connection fails mid-meeting.
By Evin JohnPublished 8 min read
1. Clarify the requirements
The prompt "design Zoom" can mean a two-person call or a webinar for ten thousand viewers. Those are different systems, so pin the meeting size down before anything else.
- Functional: create a meeting and share a link; join with audio and video; mute, camera off, screen share; see who is present; chat in the meeting; optional cloud recording.
- Non-functional: mouth-to-ear delay low enough for natural turn-taking (a commonly cited target is under about 150 ms one way, and conversation gets awkward well before half a second); smooth degradation on bad networks; a call should survive the loss of one server.
- Scope to agree: meetings up to roughly 100 active participants. Broadcast-style events with thousands of passive viewers usually switch to a different delivery path, which you can mention at the end.
2. Estimate the scale
All figures below are assumptions chosen to make the arithmetic easy. They are not the traffic of Zoom, Google Meet, Microsoft Teams or any other real product.
| Quantity | Assumption | Result |
|---|---|---|
| Concurrent participants at peak | 2 million | about 400,000 live meetings at 5 people each |
| Upload per participant | simulcast layers of about 1.5 + 0.5 + 0.15 Mbps | about 2.15 Mbps each, 4.3 Tbps into the media servers |
| Download per participant | mix of one large and several small tiles, about 2.5 Mbps | about 5 Tbps out of the media servers |
| Media servers | about 10 Gbps of useful egress per server | about 500 servers at peak, roughly 1,000 with headroom and spread across regions |
| Joins | 10 million meetings a day, 5 joins each | about 580 joins a second on average; plan for 10x at the top of the hour |
The numbers make one point clear: signaling is small and ordinary, and bandwidth through the media servers is the cost that dominates. Every later decision about forwarding, layers and placement is really a decision about that egress figure. The capacity estimation guide shows how to run this kind of arithmetic quickly.
3. Define the API
POST /v1/meetings -> 201 { meetingId, joinUrl, hostKey }
POST /v1/meetings/{id}/join -> 200 { token, signalingUrl, iceServers[] }
WebSocket wss://signal.example/{meetingId}?token=...
client -> server: offer(sdp), iceCandidate, mute(kind), subscribe(participantId, layer)
server -> client: answer(sdp), participantJoined, participantLeft, activeSpeaker(id)The join response hands back a short-lived token, the signaling address and a list of STUN and TURN servers. The client then negotiates a media session with the assigned media server using SDP offers and answers, which is how WebRTC sets up a connection.
4. Sketch the data model
| Entity | Where it lives | Key fields |
|---|---|---|
| Meeting | Relational database | meeting_id, host, scheduled time, settings (waiting room, recording allowed) |
| Participant session | In-memory store keyed by meeting (Redis or the signaling node itself) | session_id, display name, assigned media server, muted flags, joined_at |
| Room-to-server map | Coordination store with leases | meeting_id to media server (or servers, when cascaded) and region |
| Recording | Object storage plus a metadata row | meeting_id, file location, duration, status |
Do not persist every mute toggle or speaker change. Room state is rebuilt from the clients when they reconnect, so losing it costs a second of confusion, not data.
5. How media travels: mesh, SFU or MCU
| Topology | How it works | Good at | Breaks down when |
|---|---|---|---|
| Mesh (peer to peer) | Every participant sends a separate stream to every other participant | No media servers to pay for; lowest delay for two or three people | Upload grows with the group: 10 people at 1.5 Mbps means 13.5 Mbps of upload each, beyond many home links |
| SFU (selective forwarding unit) | Each participant uploads once; the server forwards chosen packets to each receiver without decoding them | Cheap per stream, low added delay, works with end-to-end encryption schemes | Receivers still download several streams; very large meetings need cascading |
| MCU (multipoint control unit) | The server decodes every stream, mixes one composite picture and re-encodes it per receiver | One stream down per receiver; helps very weak devices and legacy room systems | Decode and encode per meeting is expensive and adds delay; the layout is fixed by the server |
Pick the SFU and say why: it moves bytes instead of pixels, so one server can carry many meetings, and it lets each receiver get a different quality. Keep mesh as an optimization for one-to-one calls, and mention an MCU only for dial-in phones or old hardware.
Simulcast and layers
With simulcast, the sender encodes the same camera feed at, say, three resolutions and uploads all three. The SFU forwards the high layer to someone viewing that person full screen, the low layer to a thumbnail, and nothing at all for a tile that is off screen. Scalable video coding (SVC) reaches a similar result with one layered stream the server can trim. Either way, the receiver's bandwidth estimate drives the choice, and the server can switch layers within a fraction of a second when a network gets worse.
Audio is handled differently
Audio is tiny compared with video but matters more: people forgive a frozen frame, not missing words. Clients mark speech with an audio level, and the SFU forwards only the loudest few speakers to everyone. That also powers the active-speaker highlight. A jitter buffer on the receiver smooths uneven packet arrival, and packet loss concealment fills short gaps instead of waiting for resends.
6. The architecture
- Clients
- Desktop, web and mobile apps
- Encoder with simulcast layers
- Control
- Meeting API
- Signaling service (WebSocket)
- Room-to-server allocator
- Connectivity
- STUN servers
- TURN relays (UDP, TCP or TLS on port 443)
- Media
- SFU fleet per region
- Cascade links between regions
- Async
- Recording worker
- Object storage
- Quality metrics pipeline
- JoinThe client calls the join endpoint, gets a token and a list of ICE servers, then opens the signaling socket for that meeting.
- AllocateThe allocator picks a media server near the first participant with spare capacity and records the choice under a lease, so later joiners land on the same server or its cascade.
- ConnectThe client gathers network candidates. STUN tells it its public address; if a direct UDP path to the media server fails, it falls back to a TURN relay, often over TCP or TLS on port 443 for strict corporate networks.
- StreamMedia is encrypted with SRTP and flows over UDP. The SFU forwards the right layer to each subscriber and sends bandwidth feedback so senders can adjust.
7. Scale it across regions
- Place the meeting near its people. Assign the media server in the region of the first joiner, or of most invitees for a scheduled meeting.
- Cascade when the room spreads out. If half the participants are in Europe and half in Asia, give each group a local SFU and link the two servers with one stream per sender. Each person keeps a short last hop, and the long-haul link carries each stream once.
- Treat signaling as a normal stateless tier. WebSocket servers keep a connection per participant; room state sits in a shared store, so any node can take over a socket after a reconnect.
- Spread load by meeting, not by request. A meeting is the unit you place. Track per-server egress and refuse new rooms on a server above a threshold rather than overload it.
- Large broadcasts are a different mode. For thousands of passive viewers, have a small set of speakers on the SFU and convert the output to a segmented stream served through a CDN, accepting a few seconds of delay for the audience.
8. What breaks, and what you do about it
| Failure | Effect | Mitigation |
|---|---|---|
| Media server crashes | Everyone in its meetings freezes | Clients detect silence within a couple of seconds, ask signaling for a new server and renegotiate; the allocator reassigns the room |
| Participant on a lossy network | Their video stutters, or they drag down others | Bandwidth estimation, lower simulcast layer, forward error correction for audio; never slow the room to the weakest link |
| UDP blocked by a firewall | Call cannot connect | TURN over TCP or TLS on 443; costs more relay bandwidth, so budget TURN capacity separately |
| Signaling node restarts | Sockets drop | Clients reconnect with their session ID; media keeps flowing meanwhile because it does not pass through signaling |
| Top-of-hour join spike | Allocator and API overloaded | Pre-warm capacity before the hour, rate-limit retries with jitter |
9. Trade-offs to discuss
- SFU or MCU. Forwarding is cheaper and more flexible; mixing helps weak clients. Many products use forwarding for most participants and mixing only at the edges.
- UDP and loss over TCP and delay. Retransmitting a lost video packet is often pointless because the frame is already late. Media accepts loss; chat and signaling do not.
- End-to-end encryption. With an SFU, transport encryption terminates at the server. True end-to-end encryption adds a second layer of encryption on the media payload with keys only clients hold, which blocks server-side features such as cloud recording and live captions.
- Recording location. A server-side recorder joins as a hidden participant and writes a composite file, which is simple but costs decode and encode work. Local recording avoids that cost but depends on the host's machine staying online.
- How many video streams to forward. Sending every tile at medium quality is fair but expensive; sending the active speaker high and the rest low matches how people watch.
10. How to talk through it in the interview
Fictional example
- Interviewer
- Design a video calling product like Zoom.
- Candidate
- How big are the meetings? Two people, a team of ten, or a webinar for thousands?
- Interviewer
- Mostly team calls, up to about fifty people.
- Candidate
- Then I will separate signaling from media, use a selective forwarding unit with simulcast for the media, and come back to cascading across regions and to what happens when a media server dies. I will assume two million people in calls at peak so we can size the bandwidth.
- Draw the two planes as separate lanes and keep them apart for the rest of the interview.
- Compare mesh, SFU and MCU in one breath, then commit.
- Expect "what if a firewall blocks UDP?" and "what if a server dies mid-call?" and answer with TURN and client-driven reconnection.
If the interviewer pushes on chat or presence instead of media, the WhatsApp walk-through covers message delivery and online status in depth, and the same ideas apply to in-meeting chat.
Rehearsing this design with Natively
This prompt rewards people who can explain packet flow without hand-waving, which is hard to judge from notes alone. Hold a mock round on an actual video call with a friend asking the follow-ups. Natively runs on your Mac or Windows computer, transcribes your microphone and the other side separately, and can suggest points for the question just asked, for example the TURN fallback you forgot. Ask it to draw the signaling and media lanes and compare its diagram with yours. Reading the saved transcript afterwards shows how long you spent on topology versus failure handling.
Questions people ask
What is the difference between an SFU and an MCU in video conferencing?
An SFU (selective forwarding unit) receives each participant's stream once and forwards packets to the others without decoding them, so it is cheap and adds little delay. An MCU decodes every stream, mixes one composite picture and re-encodes it, which helps weak devices but costs far more compute per meeting. Most interview answers pick the SFU.
Why do video calls use UDP instead of TCP?
A lost video or audio packet is usually useless by the time it could be resent, because the moment it belonged to has passed. UDP lets the receiver skip or conceal the gap and keep going, while TCP would hold back every later packet until the lost one arrives. Signaling and chat still use reliable connections.
What are STUN and TURN servers for?
Most devices sit behind NAT routers and firewalls. A STUN server tells a client which public address it appears from so a direct UDP path can be tried. When that fails, a TURN server relays the media, often over TCP or TLS on port 443, at the cost of extra bandwidth on your side.
How does a video call adapt to a bad connection?
Senders upload several quality layers (simulcast) or one layered stream (SVC), and the receiver's bandwidth estimate tells the server which layer to forward. When the network gets worse the server switches that receiver to a lower layer, and audio uses loss concealment and error correction, so one weak link does not lower the quality for everyone.
Where to go next
Practice with the same assistant you would use on a call: it listens, transcribes and suggests answers from your own resume and the job description.
Facts on this page were last checked on . Product details come from the Natively app itself; if something here is out of date, tell us at hello@heynatively.com.
