If you pick the wrong WebRTC topology, you'll hit a wall at a participant count you could have predicted on day one. The good news: the math is simple, and you can do it before you write any code. For most apps, the answer is a WebRTC SFU. Here's why, and where it stops being enough.
The three WebRTC topologies
**Mesh. **Every participant sends their video directly to every other participant. No media server needed.
SFU (Selective Forwarding Unit). Every participant sends one stream to a server. The server forwards it to everyone else without decoding it.
**MCU (Multipoint Control Unit). **Every participant sends one stream to a server. The server decodes all of them, mixes them into one layout and sends that single stream back.
What your SFU doesn't do
An SFU moves media. It doesn't introduce peers to each other. Before a single packet flows, each client swaps an SDP offer and answer and its ICE candidates with the server over a signaling channel, usually a WebSocket, or WHIP and WHEP over HTTP.
Some SFUs ship that channel for you (LiveKit, Janus, Ant Media Server). Others, like mediasoup and Pion, leave it to you. If you're choosing, this comparison of the signaling layer that sits in front of the SFU covers six open-source options and which ones include signaling.
A rule of thumb for your app
- 2 people: peer-to-peer with STUN, plus TURN for strict networks.
- 3–4 people: mesh is fine.
- 5–100 people: one SFU.
- One-to-many broadcast: an SFU origin plus edge servers.
Skip building the signaling layer
Read the full guide to WebRTC signaling servers to see how signaling, ICE and TURN fit around your SFU.
Or start a 14-day free trial of Ant Media Server, which includes the SFU, signaling and WebRTC playback in one install. No credit card needed.
WebRTC SFU FAQ
What is a WebRTC SFU?
A Selective Forwarding Unit is a media server that receives each participant's stream once and forwards it to others without decoding it.
Is an SFU better than mesh?
Past about four participants, yes. Mesh makes every client upload a copy of its video for every other person.
Does an SFU handle signaling?
Not by itself. Signaling is a separate channel, though many SFU products include one.

Top comments (0)