Stress testing RTMP server

After working with Nginx-RTMP, I wanted to see how much traffic I could actually put through my server setup. I tried just streaming a bunch of video feeds from the server, but I ran out of processing power on my desktop. I had to figure out a better solution.

Enter Flazr. Flazr is a Java application that allows you to, among other things, stress test an RTMP server.

What you’ll need is:

  • RTMP target – Hopefully with a FAT network connection
  • RTMP Client – This should be a device watching a video feed from the server, making sure video problems don’t pop up
  • RTMP Stress tester – This is the machine running Flazr. I used an Atom computer running Ubuntu 14.04 server for my Flazr machine. It should run on anything that runs Java.

For basic usage, just use the command line to initiate the test. Here’s an example of a configuration I used.

./ -load 100 rtmp://

The stream I was pulling was at 1500kbps. Here’s the bandwidth being used on the RTMP server.

 rx: 6.20 Mbit/s 8944 p/s tx: 169.46 Mbit/s 18667 p/s

And here’s the CPU usage on the RTMP server.

 load average: 0.01, 0.02, 0.05

Obviously, my server can handle more than 100 connections. Let’s crank it up to 675! 675*1.5mbps = 975mbps.. That’s just about hitting the top end of gigabit.

Before we do that, we should probably increase the heap size for Flazr. On Ubuntu, type nano to edit the script. Change -Xmx512m to -Xmx2048m (if you have at least 4gb of RAM in the machine).

./ -load 675 rtmp://

Server bandwidth @ 675 clients

 rx: 6.04 Mbit/s 8655 p/s tx: 961.13 Mbit/s 81735 p/s

And server load @ 675 clients

load average: 0.07, 0.03, 0.05

As you can see, RTMP streaming is very efficient. It only requires massive bandwidth. Even with 675 clients, the video was still smooth when viewing it from another machine.

Leave a Reply

Your email address will not be published. Required fields are marked *