P2P vs SFU Video Calls: Which is Best?

Discover what P2P and SFU actually are and why we recommend you use our SFU for the best (but still secure!) video calls.

As our product evolves, we’re constantly making improvements to how our video calls work. We’re finding ways to make sure our customers can have the best possible video calls, while remaining secure and private. Historically, P2P (peer-to-peer) rooms were seen as the best solution for secure connections, sometimes at the detriment of call quality. But as our infrastructure evolves and improves, we’ve made significant changes to our SFU (Selective Forwarding Unit) so that you no longer have to choose between security and quality. You can have the best of both worlds!

And on top of that you can get more support from us, better ability to troubleshoot and benefit from our ongoing improvements in the future.

Read on to discover what P2P and SFU actually are and why we recommend you use our SFU for the best (but still secure!) video calls.

What is an SFU?

A Selective Forwarding Unit or SFU is a server that functions as a media router. You can think of it as being located in the middle of a group of participants in a video call. All participants securely connect to this central SFU, and it decides which video and audio to send securely onward to each participant.

What are the benefits of an SFU?

The nice thing about this type of setup is that it can scale really well: each participant is connected with the SFU using a single bidirectional connection through which media flows, regardless of the number of participants in the meeting. Larger meetings will use a bit more bandwidth and CPU than smaller ones, but the impact grows linearly rather than exponentially. Whereby currently supports SFU-powered meetings of up to 200 participants.

In order to optimally serve our globally distributed customer base, we use a secure mesh network of SFUs. This allows for short distances between call participants and a Whereby SFU, wherever they are in the world. For example, a user in Hong Kong on a Whereby call with someone in Paris will securely connect to our SFU in Singapore, which is part of a secure mesh with our SFU in Germany, to which our user in Paris securely connects.

The SFU also conducts optimisations to deal with challenging network conditions. When the SFU detects that a user’s bandwidth is limited, it will send a lower quality video layer onward to this user, or even stop sending video frames altogether and prioritise audio since audio is more critical.

What are the negatives of an SFU?

The downside of using an SFU is that traffic between participants is not end-to-end encrypted. It is secure, but the SFU acts as a party in the middle, in a similar way as other tools that act as a midpoint in a process or service. For example, Stripe needs to be implemented in the middle of a payment process in order to handle transactions between a customer and merchant. Connections to and between our SFU servers all happen over HTTPS, so they are secure, and we have set up our infrastructure so that video and audio streams passing through our SFU mesh flow in an entirely ephemeral fashion and are not inspected.

What is P2P?

P2P (or Peer-to-peer) calls are calls where participants are connected directly to one another without a server in the middle. There are however cases where the connection is tricky to establish, for instance, because one of the parties is behind a corporate firewall. In such cases, a TURN server is used to relay data between users that cannot directly communicate with each other due to network restrictions, while preserving end-to-end encryption.

In P2P calls, media quality handling happens by the participants’ browsers. These browsers algorithmically figure out what quality and size to send to other participants in order to deal with network constraints.

What are the benefits of P2P?

P2P calls can be beneficial for some very simple use cases such as one-to-one calls where both users have a reliable connection, and are in relatively close proximity of each other. Since calls happen directly between the participants’ browsers and the call data is not routed through a server, these calls are also completely end-to-end encrypted.

What are the negatives of P2P?

There are drawbacks. P2P calls require direct connections between all participants, so they don’t scale very well. Calls with a few participants are OK, but larger calls require a large amount of data to be transmitted to and from all participants. Additionally, they can be quite resource intensive, making them hard to run on underpowered devices with less CPU. This is why we limit the number of participants in a P2P call to a maximum of 4 and suggest customers use our SFU rooms in the majority of cases.

Why we recommend SFU video call rooms

In order to ensure the best possible call quality, no matter how many people are on the call, we suggest using SFU, or as we call them, “group” rooms for nearly all Whereby use cases.

By using our SFU:

  • We can ensure more consistent quality: the SFU works its magic in the background to help manage bandwidth usage of different resources (namely video and audio).

  • You will have more ability to troubleshoot and we can better support you when you do run into issues.

  • You will benefit from any future updates and improvements we make to our SFU mesh (which we are constantly working on).

  • Your rooms are ready to be used by more than 4 participants if the need arises.

What about Security and HIPAA Compliance?

All Whereby rooms are secure and can be implemented to comply with HIPAA, whether you use P2P or SFU. So you have nothing to worry about when it comes to security, privacy or compliance by using our SFU for your video calls. Whereby is accessible only via TLS 1.3 and TLS 1.2 with specific ciphers enabled, as described in our advisories and as it can be seen from our A grading on SSL Labs.

How to Configure P2P or SFU rooms using Whereby

You can create both P2P and SFU rooms in your Embedded account either via the dashboard, using our Rest API or using Postman.

  • P2P rooms are currently called “normal” rooms

  • SFU rooms are currently called “group” rooms

Instructions

How to create rooms from your dashboard

How to create rooms using the Rest API

How to create rooms using Postman

Other articles you might like