Architecting your WebRTC application for scalability
Alberto Gonzalez and Arin Sime
TADSummit
Nov 8-9, 2022
How to Architect your WebRTC application for scalability!
@WebRTCventures
Alberto Gonzalez, CTO
Arin Sime, CEO
Agenda
WebRTC is not quite this simple…
@WebRTCventures
4 Ways to build your app…
@WebRTCventures
#1 – Building to the WebRTC Standard
You must build and handle of the following – with great power comes great responsibility!
https://webrtc.org
@WebRTCventures
#2 – Unbundling WebRTC
May be appropriate when you find yourself saying “I wish WebRTC would do this instead…”
@WebRTCventures
Typical WebRTC
media server
Capture
Encode
Send
Receive
Decode
Play
WebAssembly
media server
Capture
Web
Codecs
Web Transport
Web Transport
Web Codecs
Play
Diagram adapted from a presentation by Tsahi Levent-Levi on WebRTC Live, bloggeek.me
Unbundled WebRTC - Allows use of other standards to have more control of the codecs, transport, as well as add in insertable streams
#3 – Open Source Media Servers
Media Servers will handle:
But you host/manage:
Media Servers
Your cloud servers
@WebRTCventures
#3 – Open Source Media Servers
Media Servers
Your cloud servers
janus.conf.meetecho.com
jitsi.org
@WebRTCventures
Popular examples:
Pion.ly
mediasoup.org
LiveKit.io
#4 – CPaaS – Communications Platforms
Your Application servers
A CPaaS will handle:
But you pay according to usage
CPaaS
@WebRTCventures
#4 – CPaaS – Communications Platforms
Your Application servers
CPaaS
@WebRTCventures
Popular examples:
It’s all about tradeoffs…
WebRTC architecture | WebRTC Standard | Unbundled WebRTC | Open Source Media Servers | CPaaS |
Up front cost | High | High | Medium | Low |
Ongoing cost | Low | Low | Low | High |
Technical difficulty | High | Medium-High | Medium | Low |
Features included | Low | High* | Medium | High |
@WebRTCventures
*Not really included, but you have flexibility to build your own on top of the underlying APIs
And what about intellectual property?
Also, what works for you today does not have to be your long term choice.
WebRTC Scaling Challenges
@WebRTCventures
SFUs or MCUs can help scale WebRTC
MCU – Multipoint Control Unit
SFU – Selective Forwarding Unit
Either can add features beyond scaling
@WebRTCventures
MCU example
Media Servers offering MCU capability (not a comprehensive list):
MCU
@WebRTCventures
SFU example
Media Servers offering SFU capability (not a comprehensive list):
SFU
@WebRTCventures
Scaling beyond single media server applications
Depends on the use case… What happens if we have 1000+ viewers?
For large broadcasting applications:
@WebRTCventures
SFU
SFU
SFU
Scaling beyond single media server applications
For large multiparty video conferencing applications:
@WebRTCventures
SFU
SFU
Scaling beyond single media server applications
Video group calls with telephony integration
@WebRTCventures
MCU
IP-PBX
Phone caller
User 2
Web Publishers
User 1
User 1
Web
Web
Publishers
SFU
User 2
Phone caller
User 3
IP-PBX
User 1
MCU
SIP/RTP
SIP/RTP
RTP
WebRTC
Large Video Conferencing Architecture considerations
@WebRTCventures
Orchestration and Containers in WebRTC applications to Achieve Horizontal Scalability
Challenges
@WebRTCventures
WebRTC Scalability Autoscaling Rules
Planning your autoscaling rules
@WebRTCventures
Example of users joining media servers at a different pace
WebRTC scalability, stickiness and persistence
Sticky Sessions
Data Persistence
@WebRTCventures
Basic WebRTC Scalability and High Availability Architecture
WebRTC load testing: testing your scalable application
@WebRTCventures
Approaches
What do we want to validate?
Application and Media Optimizations today
What can you do?
@WebRTCventures
WebRTC SFU
SVC example
WebRTC SFU
Audio #1
Audio #2
Audio #4
Audio #3
A#3
A#2
A#1
Receiving Opus RED (Redundant Audio Data) example
Missing packet
Application and Media Optimizations tomorrow
What will be recommended soon?
@WebRTCventures
*It is possible to use it but performance encoding is not great due to average hardware not being ready and some browsers and devices don’t support it yet
Lyra v2 Google open source results: https://opensource.googleblog.com/2022/09/lyra-v2-a-better-faster-and-more-versatile-speech-codec.html
Thank you!
Learn more about us:
https://webrtc.ventures
Follow us on Twitter:
@WebRTCventures
Experts in live video app development for:
Telehealth, Broadcasting, Contact Centers, and More!
@lbertogon
@arinsime
Contact us at team@webrtc.ventures