System-design interview · Extended interviews
Design a live video-conferencing service
Connect a small interactive call, then scale it with selective forwarding while keeping media quality, membership and recovery explicit.
You will learn to
- Explain signaling, network traversal and media transport in one complete call.
- Compare a peer mesh with a selective forwarding server using bandwidth estimates.
- Defend permission changes, congestion handling and reconnect behavior.
Practice in this chapter
8 interview questions with model answers and follow-ups.
Go to interview practiceUseful foundations: HTTP APIs and request lifecycle · Real-time communication: polling, long polling, SSE, and WebSocket · Load balancing: definition, algorithms and failover · Production readiness: SLI, SLO, observability, and recovery
Workload and timing examples are interview assumptions.
Dotted concept links open the relevant explanation in a new tab.
01Separate joining a room from hearing another person
A conferencing service carries interactive audio and video among two to twenty-five participants. Room creation, invitations and participant lists are control operations. Media packets carry the actual conversation. A connected signaling socket or a green room badge does not prove that anyone can hear or see another participant.
Ask how many participants must interact, whether reduced video is acceptable under congestion, and whether the media server may access media. This design supports rooms of two to twenty-five, prioritizes audio and trusts the media server; recording and server-excluding encryption are separate extensions.
Use six people joining a weekly meeting. Each browser authenticates, obtains room permission, negotiates supported media settings and establishes a network path. It then sends encrypted audio/video and receives the tracks it is allowed to hear and see. A track is one audio or video stream, such as a microphone, camera or shared screen.
The complete flow is authorize room join → exchange connection information → establish transport → publish and subscribe to permitted tracks → adapt quality during the call. Begin with two browsers to make that flow concrete. Add a media forwarding server when the bandwidth cost of many direct peer connections becomes unacceptable. Recording, transcription and very large broadcasts are optional extensions, not prerequisites for a working interactive meeting.
02Functional requirements
Agree on what the service must do before choosing its components.
- Create and join rooms. Create rooms and admit authenticated or invited participants. Invitations are scoped credentials, not access to every room.
- Control live media. Publish and receive permitted microphone, camera and screen-sharing tracks, with microphone/camera controls and a current participant list.
- Enforce room permissions. Let authorized hosts change roles or remove participants. Enforce decisions on actual publication and subscription, not only the visible participant list.
- Reconnect a participant. Rejoin after a network change or media-server failure while preserving authorized room identity and checking current permission. Recording, transcription and very large broadcasts are outside the main scope.
03Non-functional requirements
Use these hypothetical requirements for the worked interview. Confirm the assumptions with the interviewer; the numerical targets require testing and are not measured results. For latency, p95 and p99 mean that 95% and 99% of measured delays, respectively, are no greater than the reported value.
- Workload. Support two to twenty-five participants per room. Use 10,000 concurrent six-person rooms for the worked capacity estimate and test the more expensive 25-person case separately. Count actual media subscriptions and qualities, not just connections.
- Join and conversational latency. Budget roughly 150–250 ms one-way media delay on supported network paths. Target p95 below three seconds from an authorized join request to first usable remote audio when another participant is publishing; exclude time the user spends granting device permission. These targets do not cover every geographic path or unusable client network.
- Usable degradation and recovery. Prioritize audio while reducing video under congestion. Measure audio gaps, video freezes, join failures and reconnect time separately. Brief interruption is allowed during a network change or media-server failure; reconnection cannot recover packets already lost or restore an old encryption session automatically.
- Permission freshness. Target removal within five seconds on healthy connected control paths, reconcile membership every fifteen seconds and stop affected sessions after sixty seconds without successful authority refresh. Reject stale invitations/reconnects after removal. This is an outage policy, not an instantaneous or globally strict revocation deadline.
- Transport security. Encrypt media on each network leg and authorize track ownership and subscriptions. The initial design trusts the media server to process media; transport encryption is not end-to-end encryption that excludes that server. Keep invitation/session grants finite and network-relay access authenticated.
04Connect two browsers before adding a media cluster
One application server authenticates two participants and checks the room membership. A signaling connection carries messages between them: an offer describes supported codecs and proposed media, and an answer selects compatible settings. A codec is the method used to encode and decode audio or video. Signaling coordinates the call; it is not the channel that carries all media frames.
Finding a usable network path
| Mechanism | Role |
|---|---|
| ICE (Interactive Connectivity Establishment) | Tests candidate network paths between the browsers. |
| STUN service | Helps a browser discover the public address seen outside its local network. |
| TURN server | Relays packets when direct connectivity is blocked. |
STUN does not itself provide that relay service.
Once a usable path and encrypted transport are established, each browser sends its microphone and camera media to the other. The receiver buffers a small amount to smooth uneven arrival, decodes the packets and plays them. Report success from actual media progress, such as first received audio or video, rather than only signaling completion.
If one browser changes networks, it can renegotiate the connection and run connectivity checks again. The room session identifies the participant independently of that temporary transport. This baseline is complete for two people and supplies a reference for diagnosing later forwarding-server failures.
Signaling coordinates the setup; media uses a tested direct or relayed path.
Read each connection in order
- syncAuthenticate and exchange setupBrowser A → Room and signaling API
- syncAuthorized offer / answerRoom and signaling API → Browser B
- syncDiscover or relay a pathBrowser A → STUN / TURN services
- syncTest connectivityBrowser B → STUN / TURN services
- asyncEncrypted media on selected pathBrowser A → Browser B
05Show why a peer mesh stops scaling
In a mesh, every participant sends a copy to each other participant. With six people each sending a 1.5 Mbps video, each uploads 5 × 1.5 = 7.5 Mbps. Across the room there are thirty directed video copies, or 45 Mbps before audio and protocol overhead. A weak home uplink can fail well before the application server becomes busy.
A selective forwarding unit, or SFU, receives each publisher’s stream and forwards selected streams to subscribers. With one 1.5 Mbps upload per person, room ingress is 9 Mbps. If everyone still receives everyone at that quality, server egress remains 45 Mbps. The SFU moves replication away from each browser; it does not eliminate output bandwidth.
At ten thousand such concurrent rooms, 45 Mbps per room means 450 Gbps of media-server egress, about 202.5 TB in one hour. This dominates ordinary room metadata. Twenty-five participants all receiving twenty-four 1.5 Mbps videos would consume 900 Mbps per room.
Quality selection changes this cost. One active speaker at 1.5 Mbps plus four small videos at 0.15 Mbps uses 2.1 Mbps per receiver, or 12.6 Mbps for six receivers. Count actual subscriptions and layers, not just room count, when planning capacity.
06Give rooms, sessions and tracks clear ownership
Create a room
POST /rooms
Create the room with an owner and policy.
Join operation
- Authenticate the participant. Establish the caller’s identity.
- Authorize this room. Check membership or the scoped invitation.
- Return connection information. Supply a room session and signaling/media connection information.
The session identifies this join; it is not a permanent substitute for current room permission.
Signaling message fields
| Field | What it identifies |
|---|---|
| Room | The meeting affected by this control operation. |
| Participant session | The authenticated join making the request. |
| Track | The microphone, camera or screen stream involved. |
| Operation | The requested control action, such as publication or subscription. |
The service validates who may publish a camera, share a screen or subscribe to another track.
Room and track records
| Record | Information retained |
|---|---|
| Room state | Participants and roles. |
| Track metadata | Publisher, media kind and availability. |
An invitation or client-provided role cannot override the server’s authoritative membership decision.
Use ordered room updates or a version number so a late “participant joined” message does not undo a newer removal in the UI or media controller. On reconnect, fetch current room state instead of rebuilding membership solely from an incomplete stream of old notifications.
Media packets have their own sequence and timing information. They do not each need a database transaction. The room database stores who may participate. The SFU uses that state to decide which live packets to forward, without querying the database for every audio packet.
07Make the SFU the final small-room topology
Assign each room to one appropriately located SFU. Participants negotiate their transport with it instead of maintaining a separate media connection to every other participant. The SFU receives tracks and forwards only the subscriptions selected for each receiver. It generally forwards encoded media rather than decoding and mixing every picture into one composite video.
The subscription controller prioritizes audio, the active speaker, pinned video and screen sharing according to the product layout. A mobile participant displaying four small tiles should not receive twenty-four full-resolution videos. The server checks room permission before allowing publication or forwarding a subscription.
One room on one SFU keeps the main design understandable and avoids inter-server media coordination. Place the room near its participants when possible, with capacity-aware allocation. A globally distributed room may still have unavoidable long paths; geography cannot be repaired by merely adding more application replicas.
Scale different rooms across many SFUs. Admission considers CPU, packets per second, network egress and active subscriptions, not only connected socket count. A server can exhaust its network budget while CPU remains moderate. Multi-region room cascades and very large calls are later topology extensions with additional bandwidth and failure behavior.
The room service authorizes; the SFU enforces live subscriptions.
Read each connection in order
- asyncPublish permitted tracksPublisher browsers → Room SFU
- asyncSelected quality per subscriptionRoom SFU → Receiver browsers
- asyncMembership and policy updatesRoom membership service → Room SFU
- asyncRestricted-network pathPublisher browsers → TURN when needed
- asyncRelay encrypted transportTURN when needed → Room SFU
- asyncQuality and subscription feedbackReceiver browsers → Room SFU
08Adapt media instead of accumulating old frames
Networks vary during a call. The receiver reports loss and timing information, and the sender/forwarder uses congestion feedback to reduce offered bitrate when the path cannot sustain it. Sending more packets into an overloaded link increases delay and can damage audio as well as video.
Simulcast lets a publisher send several independently encoded qualities of the same camera. For example, 1.5, 0.4 and 0.15 Mbps layers total 2.05 Mbps of publisher upload. The SFU can select a suitable layer for each receiver without producing every quality itself. This raises publisher work and ingress compared with one stream, but can greatly reduce unnecessary receiver traffic.
A jitter buffer holds a short window of arriving packets so uneven network delivery becomes smoother playback. A larger buffer tolerates more variation but adds conversational delay. Missing audio and video are handled with deadline-aware concealment, recovery or frame dropping; retransmitting an obsolete frame indefinitely is not useful live communication.
Prioritize audio under congestion and reduce video resolution, frame rate or subscriptions. Request a fresh keyframe when decoding cannot recover from missing reference frames. Screen sharing may need a different policy because readable text and a stable image can matter more than high motion frame rate. Measure perceived quality rather than maximizing raw bitrate.
09Enforce removal where media is actually forwarded
Removing participant P6
- Authorize the host. The room service checks the host’s removal permission.
- Save the decision. Persist the membership change and send it to the SFU.
- Stop actual media access. The SFU stops P6’s publication and subscriptions and closes the associated session.
Updating only the participant list in the browser would leave media access unchanged.
Control notifications can be delayed or lost. Target removal within five seconds on healthy connected control paths. Independently reconcile membership every fifteen seconds, and stop affected sessions after sixty seconds without a successful authority refresh. Scoped session grants also have finite validity. These rules limit stale access during an outage, but do not prove immediate removal or a worst-case deadline across every failure.
Reconnect checks current membership and creates or refreshes a permitted session. A removed P6 cannot use cached signaling state to recreate subscriptions. Track ownership is tied to the authenticated session, preventing another client from publishing under a guessed participant identifier.
This design accepts a documented propagation interval between the durable removal decision and its enforcement by a healthy SFU. A strict worst-case revocation deadline needs a stronger timing and lease protocol and explicit failure assumptions. Keep that stronger guarantee in advanced discussion rather than quietly claiming it from an asynchronous notification.
10Reconnect a call without confusing transport and identity
When P2 switches from Wi-Fi to cellular, the previous network path may stop working. The client detects lost transport progress, contacts signaling and performs an ICE restart with current credentials and room state. Media can pause while the new path is negotiated. The participant need not appear as an unrelated new person, but old transport details are not assumed valid.
If an SFU fails, room allocation chooses a healthy replacement and clients reconnect their media to it. The new SFU loads current authorization and participants publish fresh transports and subscriptions. The service cannot copy a dead server’s in-flight packets into a seamless stream after the fact. Expose the interruption and optimize reconnection time.
If signaling briefly fails while media remains healthy, an existing call may continue under its current allowed session policy. New joins and permission updates are impaired, so the control failure still matters. If permission freshness expires, enforce the chosen fallback rather than keeping the session indefinitely.
TURN capacity is another recovery dependency. A call that always works on an office network can fail for users behind restrictive networks if relay allocation is exhausted. Monitor relay usage and test those paths deliberately; successful direct connections alone do not establish general reachability.
11Measure the conversation and test difficult networks
Track time to first audio/video, join success, round-trip time, packet loss, jitter, audio gaps, video freeze time, selected layers and reconnect duration. Monitor SFU ingress, egress, packets per second and CPU by region. Aggregate room health can hide one receiver whose connection is unusable, so retain privacy-aware per-session diagnostics with limited retention.
Test high loss, fluctuating bandwidth, restrictive network traversal, a slow receiver, Wi-Fi-to-cellular changes and a full SFU failure. Verify that audio survives reasonable video degradation and that subscription changes actually reduce output traffic. Load tests should reproduce realistic packet rates and layer switching, not only open thousands of idle sockets.
Test removal followed by a stale reconnect, invitation expiry, unauthorized screen sharing and permission authority outages. The expected behavior must match the stated grace and propagation policy. Restrict TURN use with authenticated short-lived credentials so the service does not become a public relay for unrelated traffic.
Recording is a separate authorized media subscriber if introduced later. It adds consent, storage, retention, gaps and encryption questions. End-to-end encryption excluding the server changes which processing is possible. Neither feature should be appended as a casual box without revisiting who may access the media and how participants are informed.
12Check the design against its requirements
Before closing, check the final design against the agreed requirements. FR means functional requirement and NFR means non-functional requirement; the numbers refer to the lists above. These are proposed validation checks, not test results.
| Requirement | Mechanism in the final design | Validation and remaining limit |
|---|---|---|
| FR 1, 2; NFR 2, 5 | Authenticated signaling, path negotiation and encrypted media transport establish an actual call. | Test direct and relay paths, expired invites and unauthorized sharing. Measure first usable remote audio against the three-second p95 goal; a signaling connection is insufficient. |
| NFR 1, 3 | One SFU per room, bounded subscriptions and quality adaptation control upload/egress cost. | Load-test realistic six- and 25-person rooms, layer changes and constrained receivers. Verify audio continuity and actual packet/egress capacity; idle sockets do not model calls. |
| FR 3; NFR 4 | Durable membership, SFU enforcement and periodic reconciliation constrain media access. | Remove P6, lose a control notification and attempt a stale reconnect. Measure healthy removal and the stated 15/60-second fallback without claiming instant recall. |
| FR 4; NFR 3 | Replacement allocation and fresh transport negotiation recover authorized room participation. | Switch Wi-Fi to cellular and crash the SFU. Observe interruption and reconnection; do not claim the failed server’s lost packets survived. |
| NFR 2, 5 | Quality metrics and an explicit trusted-server boundary expose network and privacy limits. | Measure one-way delay on supported regional paths and inspect media access. Revisit the architecture before offering server-excluding encryption or recording. |
13Rapid revision
Rehearse the numbered functional requirements and non-functional targets first. Use this table to recall the mechanisms, then close with the requirements check above.
Remember: Setup succeeds only when usable media arrives.
| Prompt | Recall the mechanism and limit |
|---|---|
| What is signaling? | Control messages agree media settings and connection paths; they do not carry the conversation |
| What do ICE, STUN and TURN do? | Test candidate paths, discover an external address, and relay when direct paths fail |
| Why does mesh struggle? | Each sender uploads a copy for every other participant |
| What does an SFU save? | Browsers upload fewer copies; the server still sends a copy for each selected subscription |
| Why simulcast? | Send several quality versions so the SFU can fit each receiver’s bandwidth and layout |
| Why not buffer everything? | Old frames delay conversation; packets arriving after playback time are no longer useful |
| Where must removal act? | Stop the participant’s actual sending and receiving; check current permission on reconnect |
| What survives a network change? | Keep room identity; recheck current permission and rebuild the media connection |
| Is encrypted transport end-to-end? | Not if the trusted SFU can read media between the encrypted connections |
| What proves the call works? | Usable received media and measured quality, not just a connected signaling socket |
Close with: “I first connect two browsers completely, then use one SFU per small room to control upload cost and subscriptions. Congestion handling preserves conversation quality, and room authority governs actual forwarding. Failover reconnects media with a visible interruption; advanced encryption and global room topology are explicit extensions.”
Practise the interview questions
Say your answer aloud before opening the model answer. Then answer the follow-up and compare the reasoning.
Why can signaling succeed while the call has no media?
Reveal a model answer
Signaling only exchanges control information. Media still needs compatible settings, a reachable direct or relayed network path and successful encrypted transport. Firewalls or relay exhaustion can block media even when the application socket works.
Interviewer follow-up
What should join success measure?
Reveal the follow-up answer
Time to actual usable received audio or video, alongside the control-plane milestones.
What the answer must demonstrate: Signaling only exchanges control information. Media still needs compatible settings, a reachable direct or relayed network path and successful encrypted transport.
What are ICE, STUN and TURN responsible for?
Reveal a model answer
ICE gathers and tests candidate paths. STUN helps discover the public address observed outside a local network. TURN relays media when a usable direct path is unavailable. Discovery alone does not supply relay capacity.
Interviewer follow-up
Why test TURN specifically?
Reveal the follow-up answer
A design tested only on friendly direct networks may fail behind restrictive networks or when relay capacity is exhausted.
What the answer must demonstrate: ICE gathers and tests candidate paths. STUN helps discover the public address observed outside a local network.
What changes when six 1.5 Mbps publishers move from mesh to an SFU?
Reveal a model answer
In mesh each uploads five copies, or 7.5 Mbps. With one stream to the SFU each uploads 1.5 Mbps and SFU ingress is 9 Mbps. Full-quality forwarding to everyone still produces 45 Mbps of server egress.
Interviewer follow-up
How does subscription selection help?
Reveal the follow-up answer
One 1.5 Mbps speaker plus four 0.15 Mbps tiles uses 2.1 Mbps per receiver, reducing the room’s selected output.
What the answer must demonstrate: In mesh each uploads five copies, or 7.5 Mbps.
Why would a publisher deliberately upload several qualities?
Reveal a model answer
Simulcast gives the SFU ready-made quality choices for different receivers. It raises publisher encoding work and upload but lets a weak receiver or small tile receive less data without server-side transcoding for every subscription.
Interviewer follow-up
Does more buffering solve congestion?
Reveal the follow-up answer
No. It adds conversational delay; adapt bitrate and drop obsolete video while protecting audio.
What the answer must demonstrate: Simulcast gives the SFU ready-made quality choices for different receivers.
The host removes P6. Which components must react?
Reveal a model answer
The room service saves the authorized decision, and the SFU stops P6’s publication and subscriptions. Reconnect checks current membership. A browser roster update alone does not remove access to forwarded media.
Interviewer follow-up
Can notification delivery prove instantaneous removal?
Reveal the follow-up answer
No. Target five seconds on healthy paths, reconcile every fifteen seconds, and stop affected sessions after sixty seconds without successful authority refresh. These are a target and outage policy; a proved global worst-case deadline needs stronger timing and authority assumptions.
What the answer must demonstrate: The room service saves the authorized decision, and the SFU stops P6’s publication and subscriptions.
What happens after the room’s SFU crashes?
Reveal a model answer
Clients establish fresh transports to a replacement SFU that loads current room permission and subscriptions. There is an interruption; dead in-flight packets and transport state are not transparently restored.
Interviewer follow-up
What if only signaling disconnects?
Reveal the follow-up answer
Existing media can continue under the current session policy, but joins and membership changes are impaired and permission freshness still matters.
What the answer must demonstrate: Clients establish fresh transports to a replacement SFU that loads current room permission and subscriptions.
Is a call automatically end-to-end encrypted because transport is encrypted?
Reveal a model answer
No. Encrypted browser-to-SFU and SFU-to-browser legs may still let the trusted SFU access media. Encryption that excludes the server changes recording, transcription and moderation capabilities and needs its own key-management design.
Interviewer follow-up
How should recording be introduced?
Reveal the follow-up answer
As an explicitly authorized media subscriber with consent, retention, access and encryption behavior defined.
What the answer must demonstrate: No. Encrypted browser-to-SFU and SFU-to-browser legs may still let the trusted SFU access media.
Which load test is more useful than opening many signaling sockets?
Reveal a model answer
Realistic packet traffic with subscriptions, loss, bitrate adaptation, relay paths and region capacity reveals the media bottlenecks. Measure audio gaps, video freezes, join delay and reconnect time as well as CPU and egress.
Interviewer follow-up
What resource can saturate with moderate CPU?
Reveal the follow-up answer
Network egress or packet-processing capacity can limit an SFU before raw compute utilization looks high.
What the answer must demonstrate: Realistic packet traffic with subscriptions, loss, bitrate adaptation, relay paths and region capacity reveals the media bottlenecks.
Blank-page exercise · 45 minutes
Build the answer yourself
Design a six-to-twenty-five-person video meeting service with screen sharing, participant removal and recovery from network or SFU failure.
- Agree the numbered functional requirements and non-functional targets: room size, media controls, join/delay goals, degradation, removal and encryption scope.
- Define the quality and permission contract.
- Calculate mesh upload and SFU egress.
- Choose one SFU per room and bounded subscriptions.
- Explain network traversal and congestion adaptation.
- Check joining, media, permission enforcement, reconnection, quality and capacity against the numbered requirements; state geographic, revocation and failover limits.
Check that each component and design decision follows from your requirements and workload.
Recall the key ideas
Answer from memory before opening each card. Explain why the choice works and what it costs. Revisit missed cards tomorrow.
Design a live video-conferencing serviceThe signaling socket connects, but P2 hears nothing. Has the call succeeded?Recall first, then reveal
No. Signaling arranges membership and connection setup; media carries the conversation. Check usable received audio/video and the media network path, not just control connectivity.
Setup succeeds only when usable media arrives.
Return to lessonDesign a live video-conferencing serviceHow does an SFU reduce repeated browser uploads?Recall first, then reveal
Each publisher sends its selected quality streams once. The server forwards the appropriate versions to participants allowed to receive them.
Upload once, forward selectively
Return to lessonFinal revision
Summary and interview notes
Check room permission, establish working encrypted audio/video connections and adjust quality to each receiver’s network. A successful signaling connection alone does not establish a usable call.
Remember these points
- Agree the numbered functional requirements and non-functional targets before designing components; validate the final design against them.
- Signaling success is not media success.
- SFUs reduce publisher duplication while retaining egress cost.
- Subscription and quality choices control bandwidth.
- Membership must constrain actual forwarding.
Interview tips
- Calculate one six-person room before scaling to thousands.
- Distinguish room identity from replaceable media transport.
Important qualifications
- Large global rooms, server-excluding encryption and recording are separate extensions.
Continue after the core interview
Explore the advanced version
The advanced lesson keeps the full detailed design. Use these sections when you want to examine the stronger requirements and failure cases.
- Strict revocation deadlines and session fencing
A hard worst-case removal promise requires explicit timing and authority assumptions.
- Cascaded SFUs across regions
Useful when participant geography or room size exceeds the single-SFU contract.
- Server-excluding encryption and group keys
Changes which participants or services can decrypt media and how membership affects keys.
- Recording storage and retention
Adds authorized capture, gaps, immutable media artifacts and deletion policy.
- Scalable video coding
An alternative layering method has codec and client-support tradeoffs beyond the chosen simulcast design.
Technical references
- RFC 8825: WebRTC protocol overviewPrimary overview separating signaling, real-time transports, media, and security responsibilities.
- RFC 8445: ICEDefines candidate gathering/checking, selected connectivity, and ICE restart.
- RFC 8656: TURNDefines relay allocation and its role when direct connectivity is unsuitable.
- RFC 7667: RTP topologiesPrimary taxonomy for media topologies, including selective forwarding and mixing; our placement/lease scheme is an application design.
- W3C WebRTC RecommendationBrowser peer-connection, negotiation and media API behavior; room identity and authorization remain application responsibilities.
- RFC 8853: SimulcastSimulcast negotiation and independent encoded alternatives; support must be tested.
- RFC 9605: SFrameContent encryption for real-time media, distinct from application group-key management.
Practice marks stay in this browser.