How to Performance Test in an HTTP Live Streaming Environment
This tutorial will show you how to perform a load test on an HLS platform and explores the nature of its .m3u8 extension.
Join the DZone community and get the full member experience.Join For Free
HTTP Live Streaming protocol is designed by Apple. It can send live and on‐demand audio or video to any device with HTTP Live Streaming (HLS) technology. By using this technology, Content Delivery Networks are used to host these types of contents by separating ordinary web servers from CPU consuming transactions. HTTP live streaming performance test is essential for its quality.
HLS is an adaptive bitrate technology for different bandwidths and resolutions. HLS files are divided into small files encoded using the mpg2_ts codec. The streams are mapped to the client in real time using a .m3u8 index file based on screen size and available bandwidth.
Let’s see how to do a load test on an HLS platform. HLS files have a .m3u8 extension and it’s important for you to understand its structure and responses.
- Make an HTTP call to m3u8 files. The response is not something you see every day. It’s not an HTML, XMLor JSON It’s different. You receive the small HTTP chunks split by the CDN server.
#EXTM3U #EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=688301 http://url/1010qwoeiuryfg/0640_vod.m3u8
- Capture m3u8 chunks by adding a Regular Expression Extractor to HTTP Sampler.
By using this specific regular expression, we capture the numeric expression located in the responses like “0640_vod.m3u8”.
- Make a request to these captures m3u8 file.
You may receive thousands of chunks, so you need to make a request to each one of them.
- Add a ForEach Controller to make a request to all these chunks by setting the Input variable prefix to our Regular Expression Extractor’s Reference ForEach controller. It will work as a loop and iterate through all the received chunks.
- Create a new HTTP sampler. Pass the chunk name captured in the previous request into the path of the new URL.
We are ready to make a request to the captured chunks but one step is missing. That is, keeping the streaming alive.
- Run your test once and see the output. You have another different response coming from the chunks.
#EXTM3U #EXT-X-TARGETDURATION:10 #EXT-X-MEDIA-SEQUENCE:0 #EXTINF:10, 0640/06400.ts #EXTINF:10, 0640/06401.ts #EXTINF:10, 0640/06402.ts
- Capture the “*.ts” keywords. So we create another Regular Expression Extractor and extract .ts files.
- ForEach controller, pass Streams variable as an input to it so you iterate in it.
- Create an HTTP Sampler to make a request for these .ts links.
Now run your JMX files and see the results flow like a charm. Don't forget, HLS tests require a wide range of bandwidth, so cloud platforms will help you execute those tests easily.
Please feel free to ask questions if you have any.
So Happy Load Testing!
Try Loadium cloud.
Published at DZone with permission of Canberk Akduygu. See the original article here.
Opinions expressed by DZone contributors are their own.