Cloudflare Calls: millions of cascading trees all the way down

Renan Dincer
15 min readadvanced
--
View Original

Overview

The article discusses Cloudflare Calls, a platform that enables developers to build real-time audio and video applications using WebRTC. It highlights the challenges of scalability in WebRTC applications and how Cloudflare's infrastructure, including Selective Forwarding Units (SFUs) and Anycast technology, addresses these issues to improve performance and reduce latency.

What You'll Learn

1

How to utilize Cloudflare Calls for real-time audio and video applications

2

Why using Selective Forwarding Units (SFUs) enhances scalability in WebRTC applications

3

How to implement TURN services over Anycast for improved connectivity

Prerequisites & Requirements

  • Understanding of WebRTC and real-time communication concepts
  • Familiarity with Cloudflare services and dashboard(optional)

Key Questions Answered

How does Cloudflare Calls improve WebRTC performance?
Cloudflare Calls utilizes Anycast technology to connect users to the nearest data center, minimizing latency and improving the overall performance of WebRTC applications. This architecture allows for efficient management of media streams and reduces the bandwidth required for real-time communication.
What are the benefits of using SFUs in WebRTC applications?
Selective Forwarding Units (SFUs) reduce the bandwidth requirements by managing media streams efficiently. They receive multiple streams from participants and selectively forward them to others, which is crucial for scalability as the number of participants increases in a video call.
What is the pricing model for Cloudflare Calls?
Cloudflare Calls is currently in open beta and offers the first terabyte of usage for free each month, with charges of $0.05 per real-time gigabyte thereafter starting May 15, 2024. This allows developers to experiment with the service without initial costs.

Key Statistics & Figures

Latency to Cloudflare data centers
95%
95% of the Internet connected population is within 50ms of a Cloudflare data center.
PeerConnection establishment time
100-250ms
After optimizations, PeerConnections globally now take about 100-250ms to connect.

Technologies & Tools

Protocol
Webrtc
Used for real-time audio and video communication in applications.
Networking
Anycast
Used to route users to the nearest Cloudflare data center to minimize latency.
Protocol
Turn
Provides relay services for WebRTC clients in restrictive network environments.

Key Actionable Insights

1
Leverage Cloudflare Calls to build scalable WebRTC applications without the complexity of traditional SFU setups.
This is particularly useful for developers looking to create applications that require real-time communication, as it simplifies the architecture and reduces latency.
2
Utilize the TURN service offered by Cloudflare Calls to ensure connectivity in restrictive network environments.
This is essential for applications where users may be behind NATs or firewalls, ensuring that real-time communication remains reliable.
3
Explore the open-source video conferencing app, Orange Meets, provided by Cloudflare to understand practical implementations of their technology.
This can serve as a valuable resource for developers looking to see real-world applications of Cloudflare Calls and WebRTC.

Common Pitfalls

1
Failing to consider the geographical distribution of users when selecting SFUs can lead to increased latency.
This often happens when developers do not utilize Anycast technology, which automatically connects users to the nearest data center, thus minimizing latency.

Related Concepts

Webrtc Architecture
Selective Forwarding Units (sfus)
Turn Services
Real-time Communication Protocols