How we scaled live streaming software for thousands of simultaneous viewers

Rodion Shotsky
6 min readMar 5, 2020

--

With live video streaming a positive user experience is highly correlated with high load performance. That is why, it is critical for the video broadcasting software to be highly scalable. In other words, your platform must be able to instantly deliver live video from a broadcaster to users, no matter how many of them are simultaneously on the stream.

To make sure we offer a high quality product and understand the capacity limits of Webvideo platform we decided to load-test our video streaming technology

Live video chat platform for business

Webvideo software is an all-in-one platform for business with live video streaming. The platform may be used not only for private one-to-one video chat, where high load limit is not the key factor, but also for a wide range of business spheres, such as live cam, consulting, sport and entertainment mass event broadcasting, online-education, webinars, etc. Certainly, for these businesses a stable quality and the opportunity to have a one-to-mass video broadcasting is significantly important.

Software components

Webvideo software consists of 3 main parts:

  1. Java Web-server Application — the system responsible for the work of platform in general.
  2. WebRTC Streaming Server — a web server that delivers live video from the broadcaster to the end user.
  3. MySQL database — technology used for delivery and storage of system data.

In our load test experiment we have considered tests of web-server (1) and streaming server (2) since we have never noticed any problem with database performance.

Streaming scalability issues

When the website gains popularity, there appear more and more users who are connected to one live stream at the same time. However, the server can handle only a limited number of concurrent streams before it starts to slow down or get overloaded.

The number of concurrent streams and users that streaming server can comfortably manage varies depending on server hardware, network configuration, stream type, stream bitrate, and connection types. The only sure way to determine the limits for a particular configuration is to perform a load test that shows when performance is likely to degrade.

What is load-testing?

Load testing is a practice of modeling the expected usage of a software program by simulating multiple users accessing the program concurrently. In other words, the main purpose of load test is to observe the actual performance of system’s software and hardware under high load not on a real site, but in a test environment. This way it will not affect your business or lead to financial loss.

Webvideo software technical limitations

  1. CPU — our software is restricted to the single thread usage of CPU for each chat room. Thus, the number of users in one chat room is limited by the single core performance.
  2. Multicore — different chat rooms load can be distributed between multiple cores of CPU. That is why, the overall load of the streaming server is restricted to the entire usage of CPU.
  3. HDD/SSD — with the site load growth, we could potentially reach the physical limit of data transfer speed on HDD. However, SSD disks have much better performance capacities.
  4. Bandwidth — our servers have a limit of 1gbps connection speed to the Internet. Thus, with the increasing number of users online we could totally exhaust the channel bandwidth. For example, Full HD 1080p video takes up to 2mbps for each connection. Therefore, you can host 500 users online on a server with 1gpbs. Similarly, for HD 720p video that requires 1mbps of bandwidth you can host approximately 1,000 users online on the same server.

When we developed Webvideo system we considered potential site audience growth and different stress conditions of the system.

  1. One of the popular cases is when many users simultaneously join the chat room. We managed to achieve very good results for this case. Our system worked stably when 200 and more users join the chat room per second. We did not face any issues with chat room, broadcasting applications, or server parts of the software.
  2. Another challenging thing was optimisation of a stable live connection on the server. Our system can keep thousands of users online without any lags or crashes.
  3. The general site speed work is also very important for a website with live video chat. Server part optimization provides us opportunities to have a fast working user interface for interacting with the site.

Average load test with Selenium cloud

To test the average load limits of Webvideo software, we hosted our system on a very common server configuration with Xeon E3–1270 CPU and 16GB RAM on board. We were challenging hardware and software limits under average load for a better understanding of the system’s bottlenecks.

We set up a Selenium cloud to generate load on the site. We used 7 different servers to emulate users online that would behave like real people with Chrome browser.

We did not use very powerful server configurations, so on a single server we could host up to 50 users online. As a result, the total cloud capacity was 350 users online.

During the test we used all the resources of our 7-servers cloud. Distributing viewers between several chat rooms we have not met any issue with the site work or video streaming quality. However, we reached the physical single core CPU limit when we tried to host all the users inside a single chat room. After reaching the number of 200 users online, we experienced video lagging. That can be explained by the low performance opportunity of Xeon E3–1270 CPU. You will see in the next test how we can scale up the number of users on a different CPU.

Highload test with cloud service flood.io

We could not reach the limitations of the system in the previous type of load testing. It means that we need more resources to emulate numerous users on the site for a higher load generation.

We decided to use a paid service to generate an unlimited number of visitors to the site to check the load limit of the system. We wrote a test that emulates a real user on a website who opens a chat, writes a message once in 30 seconds, stays in the chat room for 5 minutes and leaves.

  1. Streaming server test

Firstly, we tested how many people in one chat room the streaming server can handle. For this test we were adding 50 new users per second.

In the screenshot you can see the number of users inside the chatroom and CPU usage of the CPU core that processes this chat room. Video streaming and live chat were stable with 600 concurrent users, while with 800 users it started to degrade.

2. Software test

Secondly, we wanted to test the maximum limit of simultaneous users on the website. We have managed to load a website with 3,000 users online with distributed video load on 5 servers. The system was working stable with 200 concurrent users joining per second.

We have reached the CPU limit when there were 3,000 simultaneous users on the website, and when 200 more users joined the system started to slow down.

According to our estimates, with a more powerful server configuration, it is absolutely possible to handle up to 10,000 people online on one server using additional servers for video broadcasting.

All tests were performed on the default configuration of the system without any additional optimizations. If you wish your system to be able to handle even higher load, it is required to modify the system according to your needs.

If you have any questions regarding load test of video streaming software or require further information on the technical part of Webvideo platform, visit our website online webcam net and contact our team for a free consultation.

--

--