Architecting your WebRTC application for scalability, Arin Sime

Business and Service Development at Alan Quayle Business & Service Development
Nov. 11, 2022
Architecting your WebRTC application for scalability, Arin Sime
Architecting your WebRTC application for scalability, Arin Sime
Architecting your WebRTC application for scalability, Arin Sime
Architecting your WebRTC application for scalability, Arin Sime
Architecting your WebRTC application for scalability, Arin Sime
Architecting your WebRTC application for scalability, Arin Sime
Architecting your WebRTC application for scalability, Arin Sime
Architecting your WebRTC application for scalability, Arin Sime
Architecting your WebRTC application for scalability, Arin Sime
Architecting your WebRTC application for scalability, Arin Sime
Architecting your WebRTC application for scalability, Arin Sime
Architecting your WebRTC application for scalability, Arin Sime
Architecting your WebRTC application for scalability, Arin Sime
Architecting your WebRTC application for scalability, Arin Sime
Architecting your WebRTC application for scalability, Arin Sime
Architecting your WebRTC application for scalability, Arin Sime
Architecting your WebRTC application for scalability, Arin Sime
Architecting your WebRTC application for scalability, Arin Sime
Architecting your WebRTC application for scalability, Arin Sime
Architecting your WebRTC application for scalability, Arin Sime
Architecting your WebRTC application for scalability, Arin Sime
Architecting your WebRTC application for scalability, Arin Sime
Architecting your WebRTC application for scalability, Arin Sime
Architecting your WebRTC application for scalability, Arin Sime
Architecting your WebRTC application for scalability, Arin Sime
Architecting your WebRTC application for scalability, Arin Sime
1 of 26

More Related Content

What's hot

AVX512 assembly language in FFmpegAVX512 assembly language in FFmpeg
AVX512 assembly language in FFmpegKieran Kunhya
Xcap post processing toolXcap post processing tool
Xcap post processing toolOutsource Benchmarking Projectss
Effective admin and development in iibEffective admin and development in iib
Effective admin and development in iibm16k
TLC303_Walkthrough Setting up a Highly Available Communications Platform on AWSTLC303_Walkthrough Setting up a Highly Available Communications Platform on AWS
TLC303_Walkthrough Setting up a Highly Available Communications Platform on AWSAmazon Web Services
Monitoring MySQL with DTrace/SystemTapMonitoring MySQL with DTrace/SystemTap
Monitoring MySQL with DTrace/SystemTapPadraig O'Sullivan
IBM Websphere MQ BasicIBM Websphere MQ Basic
IBM Websphere MQ BasicPRASAD BHATKAR

Similar to Architecting your WebRTC application for scalability, Arin Sime

Architecting Low Latency Applications Alberto GonzalezArchitecting Low Latency Applications Alberto Gonzalez
Architecting Low Latency Applications Alberto GonzalezAlberto González Trastoy
How to Architect your WebRTC application, Alberto Gonzalez and Arin Sime, Web...How to Architect your WebRTC application, Alberto Gonzalez and Arin Sime, Web...
How to Architect your WebRTC application, Alberto Gonzalez and Arin Sime, Web...Alan Quayle
Bridging_WebRTC_with_SIP_Alberto_WebRTCventures_Cluecon2023_NoVideo.pptxBridging_WebRTC_with_SIP_Alberto_WebRTCventures_Cluecon2023_NoVideo.pptx
Bridging_WebRTC_with_SIP_Alberto_WebRTCventures_Cluecon2023_NoVideo.pptxAlberto González Trastoy
What is WebRTC and How does it work?What is WebRTC and How does it work?
What is WebRTC and How does it work?SandipPatel533958
WebRTC Webinar & Q&A - W3C WebRTC JS API Test Platform & Updates from W3C Lis...WebRTC Webinar & Q&A - W3C WebRTC JS API Test Platform & Updates from W3C Lis...
WebRTC Webinar & Q&A - W3C WebRTC JS API Test Platform & Updates from W3C Lis...Amir Zmora
Nubomedia: the cloud infrastructure for WebRTC and IMS multimedia real-time c...Nubomedia: the cloud infrastructure for WebRTC and IMS multimedia real-time c...
Nubomedia: the cloud infrastructure for WebRTC and IMS multimedia real-time c...Luis Lopez

Similar to Architecting your WebRTC application for scalability, Arin Sime(20)

More from Alan Quayle

What is a vCon?What is a vCon?
What is a vCon?Alan Quayle
Supercharging CPaaS Growth & Margins with Identity and Authentication, Aditya...Supercharging CPaaS Growth & Margins with Identity and Authentication, Aditya...
Supercharging CPaaS Growth & Margins with Identity and Authentication, Aditya...Alan Quayle
Building a sub-second virtual ThunderDome: Considerations for mass scale sub-...Building a sub-second virtual ThunderDome: Considerations for mass scale sub-...
Building a sub-second virtual ThunderDome: Considerations for mass scale sub-...Alan Quayle
What makes a cellular IoT API great? Tobias GoebelWhat makes a cellular IoT API great? Tobias Goebel
What makes a cellular IoT API great? Tobias GoebelAlan Quayle
eSIM as Root of Trust for IoT security, João CasaleSIM as Root of Trust for IoT security, João Casal
eSIM as Root of Trust for IoT security, João CasalAlan Quayle
CPaaS Conversational Platforms and Conversational Customer Service – The Expe...CPaaS Conversational Platforms and Conversational Customer Service – The Expe...
CPaaS Conversational Platforms and Conversational Customer Service – The Expe...Alan Quayle

More from Alan Quayle(20)

Recently uploaded

From Consumer to Creator, A Guide to iOS Open SourceFrom Consumer to Creator, A Guide to iOS Open Source
From Consumer to Creator, A Guide to iOS Open SourceMax Cobb
inQuba Webinar Series 2023 - Sanlam Hyper Personalization v2.0 FINAL.pptxinQuba Webinar Series 2023 - Sanlam Hyper Personalization v2.0 FINAL.pptx
inQuba Webinar Series 2023 - Sanlam Hyper Personalization v2.0 FINAL.pptxLizaNolte
TaketoFujikawa_KES2023TaketoFujikawa_KES2023
TaketoFujikawa_KES2023Matsushita Laboratory
Nymity Framework: Privacy & Data Protection Update in 7 StatesNymity Framework: Privacy & Data Protection Update in 7 States
Nymity Framework: Privacy & Data Protection Update in 7 StatesTrustArc
Value proposition of SSI tech providers - Self-Sovereign IdentityValue proposition of SSI tech providers - Self-Sovereign Identity
Value proposition of SSI tech providers - Self-Sovereign IdentitySSIMeetup
Industry 4.0.pdfIndustry 4.0.pdf
Industry 4.0.pdfTery Lockitski

Recently uploaded(20)

Architecting your WebRTC application for scalability, Arin Sime

Editor's Notes

  1. Janus built in C, Jitsi built using Java, MediaSoup built with C++ and Pion uses Go
  2. Arin’s last slide - “and now Alberto will talk more about media servers and architectural use cases”
  3. As Arin mentioned, there are different alternatives when building your own WebRTC application. In most cases direct peer to peer communication is really not an option.. In this diagram, at the right, you can see a representation of how a 8 participants peer to peer network would look like. Without a intermediate media server helping us is a bit messy, and specially resource intensive! To reduce the amount of resources used at the edge, there are 2 popular architectures used to scaling this…
  4. MCU arch and SFU arch
  5. Now, how do we scale beyond a single MCU or SFU server? IT DEPENDS ON THE USE CASE Media processing operations are very CPU intensive! A XLarge AWS instance, for example, can’t handle more than a couple hundred of sd quality video streams. What happens if we have 1000 viewers? This is how the architecture in a very high level would look like And what about other use cases?
  6. So, in the case of larger video chat rooms, to have more than 50+ participants in the same room you might be reaching the limits of your infrastructure. It will be a good idea to use multiple MCU/SFU servers and each user can connect to them simultaneously! There are smarter ways to do this but this is an approach.
  7. And what about many concurrent connections or integrations with telephony systems like IP-PBX and so on. Well… that’s complicated but a simplified flow could look like this where we have web users connecting to an SFU/MCU from web or mobile and other users dialing in from the pstn at the right But there are potential challenges caused by differences in: the SIP implementation, supported resolutions, RTCP Muxing supported or not, different codecs or in case of H264 different profile level ID that define it. ICE (trickle) support…
  8. So what are the main considerations when deciding which of those architectures to use or implement? One is really evaluating the number of participants (small groups will make things easier). Also, do we need advance functionalities like recording? dial in pstn?
  9. Now how can we orchestrate this for horizontal scalability and handle 1000s of users calling concurrently? One proposed architecture could look like this diagram here where we have… The challenges we are trying to solve are:... stateful architectures: harder to handle crashes and scaling is difficult. We need to stick to the same server we were using before and reconnect. WebRTC doesn’t do caching like other stateless protocols like hls
  10. When scaling, if we want to be efficient we want to use auto scaling rules. This rules will… For example, in this charte we assume a connection threshold (this is the start of a new server) after 100 connections. And a server capacity of 400 connections. If our server start time is more than 60sec we wouldn’t have time to handle more than 5 new connections per second (or 300 connections in a minute spikes)
  11. Another 2 important topics when building scalable and high available webrtc solutions is sticky sessions and data persistence. By sticky sessions I mean connections that will be maintained so user always reach the same server. This is important because… Dayta persistence is what will allow us to distribute traffic between multiple concurrent services and to recover the session in case of a server failure
  12. After that, once we have our scalable infrastructure ready we will need to load test what we build. To do that it won’t be enough to simulate http requests but we will need to simulate real video and audio traffic. For that typically instances simulating participants are used to connect to the servers and send/receive media. In addition to verifying we are effectively connected and receiving the right number of connections we will need to evaluate the performance by capturing jitter/rtt/packet loss so we can obtain an acceptable quality score or emos. emos mean opinion score usually used to measure a/v quality
  13. Finally, there are also application and media optimizations you can use to have better quality and have a better experience when scaling. One way is using simulcast or SVC.. SVC is a technique that allows encoding a video stream once in multiple layers. The layers in SVC can be subtracted while maintaining the video, reducing its quality with the reduction of each layer (fps, resolution or snr layers) Another is just limiting the amount of video. Do you really need video? Some great tools just use audio (twitter spaces, clubhouse, slack huddle). In that case we can optimize a lot performance and reach a much larger audience! Or at least just get the video of the active participant using audio detection. Adapt bitrate based on video resolution, this can be done on the fly without renegotiation And for audio we have Opus RED and DTX, DTX shown in the diagram at the bottom right corner.. DTX simply eliminates audio when there is no audio at the other end…
  14. With that would almost conclude our presentation, but there are many more configuration options and optimizations that will be available in the future. Great teams of engineers are working on different fronts to surpass our current limitations. For example, AV1 and Lyra V2. AV1 has been around for a while already but most devices doesn’t support its hardware acceleration yet so it causes too high cpu usage as of today. Regarding Lyra v2: iOS and other embedded platforms are not supported at this time, but this may change in the future. You can see how lyra achieves same quality with much lower bitrates! And, since before we talked about Opus DTX and how we stop sending audio when is not necessary…Some improvements can be made for better quality. The process of dealing with the missing packets is called packet loss concealment (PLC). The receiver’s PLC module is responsible for creating audio (or video) to fill in the gaps created by packet losses, excessive jitter or temporary network glitches, all three of which result in an absence of data. To realistically continue short speech segments enabling it to fully synthesize the raw waveform of missing speech
  15. And with that, here concludes our presentation about architecting your WebRTC application for scalability. I really hope you enjoyed and learned from this! And if you are interested about this topics visit us or follow us on Twitter! Thank you so much for watching!