SFU, MCU, or P2P: What’s the Difference Between These WebRTC Architectures?

...

A Selective Forwarding Unit (SFU) is a media server that receives media from each party in a conference call, decides which streams should be forwarded to other parties, and then forwards them.

SFUs are commonly used in VoIP and video conferencing applications.

SFUs differ from Peer-to-Peer (P2P) connections, in which each party sends and receives media directly to and from the other party. They are also different from Multipoint Control Units (MCUs), which receive media from all parties and then broadcast it to all other parties.

SFUs are usually used in conferences with more than two participants since they can scale much better than P2P connections. P2P connections require each party to send and receive media to and from every other party, which can quickly become unmanageable as the number of parties increases.

SFUs, on the other hand, only need to send and receive media from each party. This means that an SFU can support a much larger number of parties than a P2P connection.

How does an SFU work?

Diagram of a SFU architecture

An SFU receives media from each party in a conference call, decides which streams should be forwarded to other parties, and then forwards them.

To do this, the SFU must first understand the media sent by each party. This is typically done by inspecting the media streams for information about the codecs being used, the resolution and framerate of the video, and so on.

Once the SFU understands the media streams, it can decide which streams should be forwarded to other parties. For example, if two parties are both sending video in HD quality, the SFU may decide to only forward one of the HD streams to save bandwidth.
The SFU can also transcribe media streams to save bandwidth, meaning it is converted from one format to another.

The SFU then forwards the media streams to the other parties. The media streams can be sent using any transport protocol, such as UDP or TCP.

What is a MCU?

Diagram of a MCU architecture

A WebRTC MCU is a communication server that helps enable real-time communication (RTC) between devices and applications. It stands for “multipoint control unit” and allows for multi-party communication by integrating various audio and video signals into a single stream.

MCUs are commonly used in VoIP and video conferencing applications.

MCUs differ from Peer-to-Peer (P2P) connections, in which each party sends and receives media directly to and from the other party. They are also different from Selective Forwarding Units (SFUs), which receive media from each party and then decide which streams should be forwarded to other parties.

MCUs can provide a high degree of compatibility with legacy systems because they emit standard signals that can be decoded by any other kind of decoder. P2P connections require each party to send and receive media to and from every other party, which can quickly become unmanageable as the number of parties increases.

MCUs, on the other hand, only need to send and receive media from each party. This means an MCU can support a much larger number of parties than a P2P connection. An MCU server architecture can be costly and hard to scale because transcoding video and audio into a single stream consumes a lot of CPU.

What is a Peer?

A peer is a computer connected to a Peer-to-Peer (P2P) network. Peers can connect and disconnect from the network at any time, and they can share resources with other peers on the network.

P2P networks are different from traditional client-server networks, in which each client is connected to a central server. In a P2P network, there is no central server; instead, each peer is equal and can connect to any other peer on the network.

P2P networks are often used for file sharing and other applications where users need to transfer data between each other.

How does a P2P (Mesh) network work?

Diagram of a P2P (Mesh) architecture

In a P2P network, each peer is equal and can connect to any other peer on the network. In order for two peers to communicate, they first need to find each other on the network. To do this, each peer broadcasts a message that contains its own IP address. Other peers on the network can then reply with their own IP addresses, allowing the two peers to establish a connection.

Disadvantages of Peer vs. MCU vs. SFU

There are several disadvantages of using a peer-to-peer connection instead of an SFU or MCU:

  1. P2P connections can be unstable.
  2. P2P connections can be slow.
  3. P2P connections can use a lot of bandwidth.
  4. P2P connections can be insecure.

Advantages of Peer vs. MCU vs. SFU

There are several advantages of using a peer-to-peer connection instead of an SFU or MCU:

  1. P2P connections are simple and easy to set up.
  2. P2P is free of charge.

Why use an SFU?

Some factors to consider when choosing a WebRTC architecture are

  • Cost
  • Scalability
  • Flexibility

SFUs can provide additional features that are not possible with P2P connections. For example, SFUs can provide transcoding capabilities, which allow media streams to be converted from one codec to another. This can be useful if two parties use different codecs and you want to ensure that both parties can understand each other.

Finally, SFUs can provide Bandwidth management capabilities. This can be useful if you want to limit the bandwidth used for a conference call. For example, you may want to limit the bandwidth used for video to save bandwidth for audio.

What are the benefits of using an SFU?

SFUs have a number of benefits over other types of media servers:

  1. SFUs can support a large number of parties.
  2. SFUs can provide transcoding capabilities.
  3. SFUs can provide bandwidth management capabilities.
  4. SFUs can provide security features.
  5. SFUs can provide quality of service features.

Difference between MCU and SFU?

The main difference between an MCU and an SFU is how they handle media streams. MCUs broadcast media to all parties, while SFUs decide which streams should be forwarded to other parties.

Conclusion

In conclusion, each of these three types of WebRTC implementations has its own advantages and disadvantages. P2P is the least efficient in terms of bandwidth and CPU usage, and it requires a high-speed Internet connection and is not as reliable as SFU or MCU. MCU is the most reliable, uses the least bandwidth, and requires a lot of resources, it is also the most complex to set up and maintain. SFU is more reliable and can be used with lower-speed Internet connections.