HTTP Live Streaming (HLS)

The artillery-plugin-hls plugin enables HTTP Live Streaming (HLS) support in Artillery. With the plugin enabled, when a request to an M3U8 playlist is made, Artillery will parse the playlist, pick one of the alternative streams, and download its segments (.ts files).

HTTP Live Streaming (HLS)

HTTP Live Streaming (also known as HLS) is an HTTP-based media streaming communications protocol implemented by Apple Inc. as part of its QuickTime, Safari, OS X, and iOS software. Client implementations are also available in Microsoft Edge, Firefox and some versions of Google Chrome. Support is widespread in streaming media servers.

Source: HTTP Live Streaming on Wikipedia

Additional reading: - HTTP Live Streaming - official Apple documentation

Usage

Install the plugin

npm install -g artillery-plugin-hls

Load the plugin in your test configuration

config:
  target: "https://video.example.com"
  plugins:
    hls: {}

Make a request to an M3U8 playlist

To stream an HLS-encoded video, make a request to an m3u8 playlist, and set the hls attribute to {} to use the default options, or customize streaming options:

scenarios:
  - name: "Stream an HLS video"
    flow:
      - get:
          url: "/streams/xyz0123/xyz0123.m3u8"
          hls:
            concurrency: 2
            streamSelector:
              resolution:
                width: 320
                height: 184
            throttle: 100

Set additional HTTP attributes (cookies, custom headers etc)

Any standard HTTP request attributes may be used in requests to M3U8 playlists, e.g. a cookie-protected playlist endpoint may be retrieved with:

scenarios:
  - name: "Stream an HLS video"
    flow:
      - get:
          url: "/streams/xyz0123/xyz0123.m3u8"
          headers:
            Cookie: name=value; name2=value2;
          hls:
            concurrency: 2
            streamSelector:
              resolution:
                width: 320
                height: 184
            throttle: 100

HLS Configuration

The following options are supported on the hls attribute:

streamSelector options

Reported Metrics

The plugin adds a number of custom metrics to Artillery reports:

Load Testing HLS at Scale

Streaming video with a large number of virtual users can quickly exhaust all available bandwidth on a single machine. Therefore bandwidth utilization should be monitored closely while tests run to scale out the number of nodes on which Artillery runs as needed.

Artillery Pro provides a solution for running tests from a cluster of nodes easily as well as a number of other team and enterprise-oriented features, and deep AWS integration.