MQTTX icon indicating copy to clipboard operation
MQTTX copied to clipboard

[Help] MQTTX CLI v1.12.1 Benchmark (bench pub) Ignores -im and -d Flags, No Summary Output

Open xzbit22 opened this issue 2 months ago • 1 comments

I'm encountering an issue with the MQTTX CLI v1.12.1 where the bench pub command does not stop after reaching the specified number of messages (-im) or duration (-d), and it fails to display the expected benchmark summary (e.g., Duration, Messages, Throughput, Latency, Errors). This behavior occurs consistently across different brokers and configurations.

C:\mqttx-cli>mqttx bench pub -h iot-broker.pnk.ac.id -p 1883 -c 1 -im 100 -t "test/bench" -q 2 --payload-size 1KB -d 10 --mqtt-version 3.1.1

√ Generated random payload of 1KB.
❯  Starting publish benchmark, connections: 1, req interval: 10ms, message interval: 100ms
√  [1/1] - Connected
√  Created 1 connections in 0.043s
Published total: 269, message rate: 9/s
C:\mqttx-cli>mqttx bench pub -h broker.emqx.io -p 1883 -c 1 -im 100 -t "test/bench" -q 2 --payload-size 1KB -d 10 --mqtt-version 3.1.1
√ Generated random payload of 1KB.
❯  Starting publish benchmark, connections: 1, req interval: 10ms, message interval: 100ms
√  [1/1] - Connected
√  Created 1 connections in 1.812s
Published total: 158, message rate: 7/s

the benchmark should stop after sending 100 messages per client (-im 100) or after 10 seconds (-d 10)

xzbit22 avatar Oct 10 '25 02:10 xzbit22

Hi @xzbit22,

There's a misunderstanding about the parameters:

  • -im 100 means message interval (publish every 100ms), not 100 messages total
  • -d is a boolean flag for duplicate messages, it doesn't accept a value. Using -d 10 is invalid
  • bench pub command doesn't have a duration parameter
  • To limit the number of messages, use -L or --limit

Correct usage to send 100 messages:

mqttx bench pub -h broker.emqx.io -p 1883 -c 1 -L 100 -im 100 -t "test/bench" -q 2 --payload-size 1KB --mqtt-version 3.1.1

This will send exactly 100 messages (every 100ms) and then stop.

ysfscream avatar Oct 11 '25 02:10 ysfscream