How to use k6 to perform mqtt load testing?

Hi,

I would like to use k6 to perform MQTT load testing, I tried to use mqttjs by using the k6-es6 starter but I’m not able to get a bundled test that is working.

import url from 'url';           // I had to add that to avoid ReferenceError: URL is not defined
import mqtt from 'mqtt';

export default function() {
  console.log("connect");
  const client = mqtt.connect('mqtt://localhost:1883');
}

The last error I got : “Invalid regular expression (re2):”

Is there any people that already got success with k§ and mqtt?

Cheers!

You currently can’t do MQTT load testing with k6. Since it involves making network connections, you wouldn’t be able to browserify or webpack a node.js module to do the job, it needs to be done as a k6 module or plugin.

You can follow https://github.com/loadimpact/k6/issues/1269 for updates on when such functionality will be available natively in k6, though it’s very likely it will first ship as a separate plugin via the new xk6 system (https://github.com/loadimpact/k6/pull/1688, https://github.com/k6io/xk6)

1 Like