30K Viewers: Scaling WebRTC Streaming Made Easy with AWS’s Cloud Formation
By: Ant Media Server
Tags: WebRTC, Ant Media Server, Live Streaming, Video Streaming Server, Video Conferencing

Scaling WebRTC streaming is one of the powerful features of Ant Media Server and you could scale up to 30K viewers easily in one minute installation with CloudFormation utility. This is 2nd part of the post series about “how to scale Ant Media Server to 100,000 viewers” and you can read the previous part of this tutorial to refresh your mind from the following link: Part I.

Scaling WebRTC Streaming

As we’ve seen in the previous part, performing a load test with 10K viewers was surprisingly easy. As a next step, we will talk about how to do that with 30K viewers. In the next series of the blog, we will be talking about how to set and reach up to 50K and 100K viewers step by step with performing load test, therefore please bear with us.

In the test environment, we are going to use the same number of Load Balancers and Databases, and only for this time, we’re going to increase the number of edge instances from 10 to 25, and the number of Loads instances from 10 to 30. Have a look at that here for a quick refresher.

How Many Instances You Need?

So let’s gets started! We have set up 25 Edge servers and 1 Origin server for 30K viewers testing and we used Ant Media Cost Calculator to define that before setting it up. Estimating an overall cost and configuration based on the number of viewers and broadcasters / publishers is a common issue for developers. To handle this issue, Ant Media Cost Calculator can help you. You can enter total number of broadcasts, viewers and then it shows you how many instances you need and how much it will cost.

https://antmedia.io/cost-calculator

Here is an example. We choose the Cloud Provider, Instance Type, number of broadcasts and number of viewers. Then it shows us how many instances we need and their estimated cost.

Quick setup in 2 Minutes with CloudFormation

We use AWS’s CloudFormation service to set up the cluster . The thing that we love best about this tool is that we complete the setup in 2–3 minutes. To mention briefly, AWS CloudFormation is a configuration orchestration tool that allows you to codify your infrastructure and automate your deployments. Keep in mind that we’re also preparing a blog post about using our CloudFormation template to set up clusters in just a few clicks. Nevertheless, if you are eager to try, here it is the Cloud Formation template for you.

https://github.com/ant-media/Scripts/blob/master/antmedia-aws-autoscale-template.yml

Improved Performance

We were already expecting a performance boost when optimizing our 2.1 version. However, at the end of the tests, it was quite surprising that our performance was increased about %35~ more than the previous version v2.0. In other words, Ant Media Server uses %35 less CPU to handle the same number of viewers.

Here is the output of the monitor tool. It seems that there is no even single connection drop for the viewers. It’s exactly 30001.

So this optimization will make our product more efficient than before allowing our customers to have much more capacity to handle in their current configuration.

Scaling WebRTC Streaming

Perfect Audio and Video Timing

Finally, when it comes to “perfect timing”, we send audio at 20ms and video at 40ms synchronously without any problem. Here is the percentile graphics.

Our next blog will be about how Ant Media Server will handle 50K and 100K. Stay tuned!

If you have any questions, please just drop a line to contact (at) antmedia.io