Streaming vid

Performance testing streaming video (into the Flash player)

This is just a snippet of information, really for my own archive, to show how you can performance test live streaming video. It's not too bad but a couple of details took some time for me to work out. Of course this is subject to change as our changing technologies progress pretty quickly in this area, but right now this is working.

Most of my work is around the surrounding web sites as we use specialist 3rd parties to provide the video feeds. But we have  a case here where we need to diagnose some issues we are seeing. So we want to mimic user load on the video feeds.

The feeds are provided through a CDN so this is something to consider as well. We may or may not want to test the CDN in relation to our video feeds.

I won't give actual LoadRunner code here, after all this is all commercial in confidence and LoadRunner really does need licenses and specialist analysts, but if you are in that position then you should be able to build your scripts using this page.

Two tricky areas were the decoding of the bootstrap file and the building of the fragment URL. You probably will need some dev input here. In fact my scripts changed as this project progressed as our methods changed and the building of the fragment addresses had to be updated.

Script outline

  1. Call the master manifest (URL well defined per stream)
  2. Get the URL info from the response and call one of the rendition manifests (I randomised the selection here)
  3. Get the URL info from the response and call the bootstrap file
  4. Save the binary bootstrap response to file
  5. Decrypt the bootstrap file
  6. Dig out the segments and fragments
  7. Build the video fragment url and call it

This works per iteration of my script. In fact a user will typically call the manifests once on opening the streams and then continually calls fragments and less often, bootstraps. But I have randomised my scripts also for different streams (tv channels) and if I leave my script as is (with each call every iteration), it is easier to ramp up the load.

I could call more than one fragment per bootstrap call but in fact the most reliable way for my streams is to always use the first segment id and first fragment id. That way, I do always get a 200. I don't have full info on how to build the different fragments available, so for now I'll have to leave the script as is:


Step 4 was a bit tricky and step 5 required some coding and organization of files:

Step 4

After figuring it out, using web_reg_save_param, I was able to get the bootstrap response (without the headers) back in a LoadRunner variable:

    web_reg_save_param_ex("ParamName=simulcast_body","LB=","RB=",SEARCH_FILTERS, "Scope=Body",LAST);

And since I now had this as a string I tried all sorts of methods to write it to file and almost gave up! After switching from fprintf to fwrite I then struggled with getting the string length. Because I actually had a string full of binary data, I couldn't get this with normal c code.

Luckily, I noticed the header: Content-Length. For fwrite, I needed this value quite specifically (or the decoder complained that the file was corrupt). So I added this:

    web_reg_save_param_ex("ParamName=contentLength","LB=Content-Length: ","RB=\r\n",SEARCH_FILTERS, "Scope=Headers",LAST);

Now I could write the response to file as binary (note the 'b' after the 'w'):

    //save the response to file
    file_stream = fopen(filename,"wb");

         lr_output_message("Unable to open %s",filename);

Step 5

You can see above the call to decrypt the file. For this you need to get hold of the Adobe f4f packager. I got this from my devs. I believe it comes with the flash development environments

And I use popen() to run the system command with a routine I've built that lets me get the lines back in buffers (you should find this approach online with a quick google). Run the command:

    sprintf(strtemp,"f4fpackager.exe --inspect-bootstrap --input-file %s",filename);
    fp = popen(strtemp, "r");

To be able to run this from the injectors though, without having to install the packager everywhere, I've added the files I need to the script:


I haven't yet run this under proper load and am a bit concerned with heavy use of external system calls. Ideally we use some of those dlls directly but I don't have the information on how to do this. If injector load becomes an issue with the current approach, I plan on ramping up the number of injectors. I use LoadRunner almost exclusively in the cloud these days, so at least this is easy to do.

Hopefully this page is enough to get you going with performance testing video streaming.


Example script outline (30Mb download - ask about details): temp_script_files

[Home] [About (CV)] [Contact Us] [JMeter Cloud] [webPageTest] [_64 images] [asset moniitor] [Linux Monitor] [Splunk ETL] [Splunk API] [AWS bash] [LR Rules OK] [LR Slave] [LR CI Graphs] [LoadRunner CI] [LR CI Variables] [LR Bamboo] [LR Methods] [LR CI BASH] [Bash methods] [Jenkins V2] [Streaming vid] [How fast] [Finding Issues] [Reporting] [Hand over] [VB Scripts] [JMeter tips] [JMeter RAW] [Dynatrace] [Documents] [FAQ] [Legal]

In the Cartesian Elements Ltd group of companies