How to Benchmark any MQTT Broker Performance Using mqtt-cli
If you're sending messages to many users or topics and experiencing latency issues, it's important to understand how your broker performs at different Quality of Service (QoS) levels. The mqtt test command from the MQTT CLI tool helps you benchmark message throughput and feature support across MQTT versions 3 and 5.
This guide walks you through running an end-to-end broker test, including QoS benchmarks, using mqtt-cli.
Instructions
✅ Prerequisites
Installed MQTT CLI (version 4.x+ recommended)
Access to your MQTT broker (hostname, port, credentials if required)
🚀 Command to Run
mqtt test --all --qosTries 1000 --host <your-mqtt-broker-host> --port <your-mqtt-broker-port> --user <your-user> --password <your-password> [--secure]What this does:
Runs all available MQTT feature tests (both MQTT 3 and 5)
Sends 1,000 publishes for each QoS level (0, 1, 2)
Reports latency and success rate for each test
📊 Sample Output Breakdown
QoS 0: Received 1000/1000 publishes in 79.90ms
QoS 1: Received 1000/1000 publishes in 131.36ms
QoS 2: Received 1000/1000 publishes in 179.37msWhat this tells you:
QoS 0 is fastest, ideal for high-throughput use cases where message loss is tolerable
QoS 1 and 2 provide more reliability at the cost of latency
This helps you tune your application to the right balance of performance and reliability
🛠️ Additional Options
Option | Description |
|---|---|
| Use TLS encryption |
| Specify |
| Customize timeout for broker response |
🧠 Use Case
For example, if you want to:
Evaluate publishing speed
Compare QoS performance
Check MQTT 5 compatibility
… the mqtt test command gives you actionable performance data in under 1 second.
HiveMQ Public Broker
HiveMQ Public Broker without TLS:
mqtt test --all --qosTries 1000 --host broker.hivemq.com --port 1883HiveMQ Public Broker WebSocket without TLS:
mqtt test --all --qosTries 1000 --host broker.hivemq.com --port 8000 -wsHiveMQ Public Broker with TLS:
mqtt test --all --qosTries 1000 --host broker.hivemq.com --port 8883 --secureHiveMQ Public Broker WebSocket with TLS:
mqtt test --all --qosTries 1000 --host broker.hivemq.com --port 8884 -ws --secureHiveMQ Cloud Serverless Broker
mqtt test --all --qosTries 1000 --host 2ed61f54b0c04f2db1eb8d16be859880.s1.eu.hivemq.cloud --port 8883 --secure --user Superuser1 --password Superpassword1HiveMQ Cloud Starter Broker
mqtt test --all --qosTries 1000 --host startertest-81c35deb.a03.euc1.aws.hivemq.cloud --port 8883 --secure --user Superuser1 --password Superpassword1Other brokers
mqtt test --all --qosTries 1000 --host test.mosquitto.org --port 1883mqtt test --all --qosTries 1000 --host test.mosquitto.org --port 1884 --user rw --password readwritemqtt test --all --qosTries 1000 --host test.mosquitto.org --port 8883 --cafile mosquitto.org.crtmqtt test --all --qosTries 1000 --host test.mosquitto.org --port 8883 --cafile mosquitto.org.crt