Skip to main content

pymqttbench

This is a tool to benchmark the performance of an mqtt broker. It works by launching an arbitrary number of publishers and subscribers in parallel. These workers both publish and subscribe to the same topic and either send or recieve a fixed number of messages.

Installation

The easiest way to install pymqttbench is use pip:

pip install pymqttbench

Alternatively you can clone the repo with:

git clone https://github.com/mtreinish/pymqttbench.git

then install it using pip:

pip install ./pymqttbench

Alternatively you can run:

cd pymqttbench && python setup.py install

however using pip is recommended.

Usage

After installing pymqttbench you simply run it with the:

pymqttbench --hostname $BROKER_HOST

command. The hostname parameter is required to tell pymqttbench the hostname of the broker. This is the only required field, but there are several other options exposed for how to connect to the broker. --port is used to specify the port if you’re not connecting on the standard port, 1883. --username and --password are used to specify user authentication if needed. Similiarly --cacert can be used to specify a trusted CA certificate to verify the TLS connection on the broker. There is also the --topic parameter which is used to specify a topic to use for the benchmark, by default pybench is used. Note that all of these settings are used for both the publishers and subscribers.

Outside of mqtt connection options there is also the --brief flag which is used to print a colon separated list of benchmark results instead of the default human readable formatted output. The format for this output is:

Subscriber Count:Publisher Count:Subscriber Mean Duration:Subscriber Duration Std. Deviation:Subscriber Avg. Throughput:Subscriber Total Throughput:Publisher Mean Duration:Publisher Duration Std. Deviation:Publisher Avg. Throughput:Publisher Total Throughput

Tuning the benchmark

After pymqttbench knows how to connect to the broker you can tune the benchmark to your specific needs. There are several axes you can adjust the bechmark on, the first being the number of publishers and subscribers. This is configurable with the --pub-clients and --sub-clients flags. By default each is set to 10. The next option you can tune is the number of messages that the publishers will send, with --pub-count, and the number of messages the subscribers will listen for, with --sub-count. It’s worth pointing out that the subscribers do not pair with an individual worker like in some other benchmarking tools, but instead listen to the same topic that all the publishers publish to. In addition with adjusting these options you’ll likely want to change the publisher timeout, --pub-timeout, and the subscriber timeout, sub-timeout, which describe how long the benchmark will wait for the worker to either publish or recieve the specified message count.

You can also set how large the message payload is with --msg-size which takes the number of bytes to use. By default it uses a 1024 byte payload. The last tuning option is --qos which is used to specify the qos level to use for benchmarking. By default qos 0 is used.

Metadata

Release files for pymqttbench 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pymqttbench 0.1.1
File Size Uploaded
pymqttbench-0.1.1.tar.gz 11.2 kB Details

Release files / pymqttbench-0.1.1.tar.gz

Download URL pymqttbench-0.1.1.tar.gz
Size 11.2 kB
Tags Source
SHA-256 checksum
How to use checksums
945bcd35a1c9e2e9b3511dfcadfa06cfb72a00490ecd50db6cc7c1875c92f2f8
BLAKE2b-256 checksum
How to use checksums
6ea9e60006d56a62d8fed8959ef398344612a2d516f3411181cd88115151df1d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.1.1 This release

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page