Live video usage is soaring as more and more people are watching streaming online content. Therefore, load testing HLS and performance testing live videos, VOD and events is becoming a must. Until now, Apache JMeter™ supported HLS load testing with a few different elements. Read more here.
But now, a new HLS plugin has been developed with the support of BlazeMeter. Here is everything you need to know to use it and performance test HLS. To learn how to load test RTMPT media streaming, click here. Get live media streaming stats from this infographic.
What is HLS?
The HLS protocol provides a reliable, cost-effective means of delivering continuous and long-form video over the Internet. It allows a receiver to adapt the bitrate of the media to the current network conditions, in order to maintain uninterrupted playback at the best possible quality.
In a HTTP Live Streaming process:
- The audio/video to be streamed is reproduced by a media encoder at different quality levels, bitrates and resolutions. Each version is called a variant.
- The different variants are split up into smaller Media Segment Files.
- The encoder creates a Media Playlist for each variant with the URLs of each Media Segment.
- The encoder creates a Master Playlist File with the URLs of each Media Playlist.
To play, the client first downloads the Master Playlist, and then the Media Playlists. Then, they play each Media Segment declared within the chosen Media Playlist. The client can reload the Playlist to discover any added segments. This is needed in cases of live events, for example.
Playlist files must be encoded in UTF-8. The format of the Playlist files is derived from the M3U playlist file format. Each Playlist file must be identifiable by either the path component of its URL or by HTTP Content-Type. In the first case, the path must end with either .m3u8 or .m3u. In the second, the HTTP Content-type must be "application/vnd.apple.mpegurl" or "audio/mpegurl".
The New HLS Plugin for JMeter
The new HLS plugin for JMeter allows users to simulate a HLS scenario by using only one custom Sampler. Now, you don’t need multiple HTTP Request Samplers, ForEach Controllers or RegEx PostProcessors. This makes the whole process much simpler than before.
Instead, the complete logic is seamlessly encapsulated so you only have to care about the use case: the media type, playback time and network conditions. That’s it! The plugin is brand new and it can be installed via the JMeter Plugins Manager.
How Does the HLS Plugin work?
This plugin solves the HLS complexity internally. It gets the master playlist file, chooses one variant and gets its media playlist file, the segments, etc. The plugin simulates users consuming media over HLS supporting different situations: stream type, playback time, network bandwidth and device resolution.
Here is what the HLS Sampler looks like:
To create your test
- Install the HLS plugin from the Plugins Manager
- Create a Thread Group.
- Add the HLS Sampler Add -> Sampler -> HLS Sampler
After that you can add assertions, listeners, etc.
Set the link to the master playlist file
Set the video type corresponding to the playlist
- Live Stream
- Event Stream
Set the playback time of the test:
- Whole video
- Video duration (seconds)
Select the protocol of the playlist you want to test. You can identify it in the link to the master playlist file:
Select the bandwidth you want to simulate in your test. If there is only one playlist for the selected bandwidth, the plugin will select the playlist based only on this criterion.
- Custom Bandwidth (bits/s)
- Min bandwidth available
- Max bandwidth available
After selecting the desired bandwidth you can select a resolution to simulate your specific device.
You can set listeners to evaluate the results of your tests. The View Results Tree Listener displays the HLS Hierarchy, so you can inspect how the requests and responses worked.
That’s it! Now, you know the most complete and easiest way to load test HLS using JMeter.
To learn more JMeter, sign up to our free JMeter academy.
Learn more about performance testing HLS from our free "Using JMeter for Performance Testing HLS Video Delivery" webinar.
You might also find these useful:
Interested in writing for our Blog? Send us a pitch!