Lesson 9 of 9 · 28m
Operating Production Calls That Survive Real Networks
Build reconnection, moderation, observability, capacity control, privacy, and post-incident feedback loops into the media system rather than bolting them on afterward.
A production calling system is not finished when two browsers connect on your office Wi-Fi. It is finished when a participant on hotel Wi-Fi can rejoin after a laptop sleep, a moderator can remove an abusive user, a deploy does not drop every room, and your on-call engineer can tell whether the failure was signaling, ICE, TURN capacity, SFU packet loss, or a browser regression. Reliability is a product feature.
Rejoin is a first-class workflow
Real sessions cross network transitions:
laptop sleep/wake, Wi-Fi/cellular handoff, VPN changes, browser tab crash,
OS permission prompts, SFU regional failover, accidental close/reopenDesign for session resume. Keep participant identity stable, assign a new device or connection instance, preserve mute and layout intent, and reconcile duplicate sockets server-side. The UI should say "reconnecting" only when the system is actually attempting recovery, not whenever a spinner looks comforting.
Capacity is measured in more than rooms
TURN bandwidth, SFU CPU, SFU egress, UDP socket count, signaling messages per second, recording workers, and database writes are all independent ceilings:
sum(rate(turn_bytes_sent_total[5m])) by (instance)
sum(sfu_forwarded_bitrate) by (region, room)
histogram_quantile(0.95, rate(signal_message_latency_seconds_bucket[5m]))
max(webrtc_active_publishers) by (sfu_instance)A server can have spare CPU and still be dead because egress bandwidth is saturated. Another can have bandwidth but exhaust file descriptors from idle sockets. Capacity planning starts with per-participant measurements, not guesses.
Moderation must propagate through every layer
When a moderator removes someone, enforce it in signaling, SFU subscriptions/publishing, TURN credential validity where possible, and rejoin authorization:
1. revoke room capability server-side
2. close or reject signaling connection
3. unsubscribe and stop forwarding their media
4. stop their publish streams
5. mark participant removed for audit and rejoin denialClosing only the browser tab is cosmetic. A hostile participant can reconnect unless the server remembers removal.
Deploy without dropping the world
Media workloads hold long-lived state. Rolling restarts need draining:
# illustrative operational sequence
sfuctl drain sfu-eu-03 --timeout 20m
sfuctl wait-empty sfu-eu-03 --grace 5m
systemctl restart sfu
sfuctl undrain sfu-eu-03Draining means no new rooms or participants are assigned while existing rooms finish or migrate. Some systems migrate media state; many simply let short meetings end. Either is valid if explicit. The invalid approach is pretending every deploy is too fast to matter.
Measure quality from the user's side
Useful call telemetry includes setup time, ICE selected pair type, reconnect count, inbound loss, jitter, audio energy continuity, video freeze duration, encoder CPU pressure, and user feedback. End-of-call surveys are noisy, but correlated with objective stats they expose blind spots:
{
"session_id": "call_7f42",
"setup_ms": 1840,
"selected_pair": "srflx-srflx",
"reconnects": 1,
"video_freeze_ms": 420,
"inbound_loss_audio": 0.012,
"mos_estimate": 4.1,
"client": "chrome-142/linux"
}Do not overclaim precision from calculated MOS. Use it for fleet trends, not proof that one user is wrong about their experience.
Incidents need correlation IDs
Every participant session should carry an ID through signaling messages, browser telemetry, SFU logs, TURN allocation records, and moderation events. Without correlation, you end up comparing timestamps across systems with different clocks. With correlation, one user report becomes a traceable narrative.
Field notes
- A green service dashboard does not mean calls are good; server health and user-perceived media quality are different measurements.
- Clock sync matters. Use NTP everywhere and include monotonic local timestamps in browser telemetry where possible.
- Load testing real media is expensive. Use headless or controlled clients carefully, and never test capacity assumptions only with silent sockets.
- Privacy review belongs in reliability work. Incident response often pressures teams to over-collect media or user metadata under stress; decide limits before the incident.
Was this lesson helpful?