Design Zoom
hard 60 minDesign video meetings like Zoom.
See it run
Join a meeting, watch one upload become many chosen copies, and see what happens when networks and servers fail.
Operations
Join a meeting
Control first, then signalling, then media straight to the SFU.
Step 1 of 13
Click the link
Noor's client sends the meeting id, the passcode and what the device can do.
Step 1: Click the link
def join(client, meeting, passcode): limiter.check(client) # 429 check(meeting, passcode, client) # 403 or 202 waiting return token(client, meeting), urls()ws = connect(urls.signalling, token)people = ws.receive("state")ws.send("offer", sdp, candidates) # by signallinganswer = ws.receive("answer")ice_checks(); dtls_handshake() # to the SFU itselfsend_rtp(layers=3); receive_rtp()- Latency
- first sound in 2 s
- Load
- 47,000/s on the hour
- Average joins
- 3,500/s
- People at once, peak
- 28M
The SFU has a public address, so a client normally needs no STUN server to reach it.
In the real world
The same video meetings doing real jobs. Pick one and step through it.
Signalling is a different service, so it can repair the media.
Step 1 of 5
All well
owner
SFU 17, fence 4
Media goes to SFU 17 with fence 4.
Step 1: All well
Common mistakes
The bugs interviewers watch for, with the fix beside each.
Media over TCP
criticalOne lost packet holds back all later sound.
Wrongwebsocket.send(audio_frame)Rightrtp.send(audio_frame) # over UDPForwarding what nobody sees
majorA thousand people with a thousand videos is 999,000 streams.
Wrongfor s in all_streams: forward(s)Rightfor s in visible(receiver): forward(s)Slowing the sender for one bad receiver
majorEveryone else loses quality.
Wrongsender.bitrate = min(all_receivers)Rightlayer[receiver] = fit(estimate[receiver])Treating the meeting number as a secret
criticalWith 2.8M live meetings in 10^11 numbers, one guess in about 36,000 is right.
Wrongif exists(number): admit()Rightlimiter.check(client)check_passcode(); waiting_room()No fence on reassignment
majorA frozen SFU can wake and split the meeting in two.
Wrongowner[meeting] = "sfu-21"Rightowner[meeting] = ("sfu-21", fence + 1)
Interview tips
Start with the deadline
- 150 ms one way.
- Spend a budget step by step.
- Late means lost.
Count streams and bits
- 9 uploads or 1.
- 2.2 up, 5.65 down.
- 28M people, 56 Tb/s.
Degrade in order
- Thumbnails, speaker, then audio only.
- Down fast, up slow.
- Each receiver alone.
Be honest about limits
- Distance costs time.
- End to end excludes server recording.
- A normal SFU could read media.