MQTT Broker Testing Tools

As part of my work with MQTT I have developed a number of broker test tools that I use . They are written in python and Node-red and  are probably only useful for small networks.

The are made available as-is and no warranty is accepted. You are free to modify them as you see fit but not to resell them.

Most of the tools are in early stages of development and I have been considering documented these tools and making them more user friendly, but before I do I would like to get your feedback as it involves considerable work on my part, and there is no point if the interest is very limited.

I would be grateful for you feedback by using the comments section.

Python Tools

This is a collection of python broker test scripts that you may find useful. The scripts are best run from an IDE as you will need to change settings for your environment.

All scripts have a use editable section near the top where you can make changes.

python-broker-test-scripts

Maximum Connection Tester

Creates multiple connections to a broker both normal and SSL and then sends messages across them and measures the time taken.

I used this when testing the 1024 connection limit on Linux.

On windows there doesn’t appear to be a limit imposed by the OS but when run on Linux you may encounter this.

Details are in the install mosquitto on Linux tutorial

download

Broker Stress Tester

There is a transmitter script and receiver script. The receiver must be started before the transmitter.

The receiver and transmitter broker and port need editing. All other settings are in the transmitter script which sends X messages in Y blocks.Each message is Z bytes and there is a delay between each message which you can set as well as a longer delay between each block.

The message delay sets the message rate and you will find that decreasing it further than a set amount doesn’t make it any faster. The rate will depend on the machine you are using.

There is also the ability to inject an error as a means of sanity checking.

The default 10 blocks,200 messages per block with a message size of 1000 bytes and a 2 second delay between blocks.

broker="192.168.1.41"
port=1883
blocks=10 #edit for number of blocks
messages=200 #edit for messages per block
message_size=1000 #edit for size of message
M_delay=0.00001 #delay between messages
Loop_delay=2
inject_error=False

You need to stop the receiver with CTRL+C as it will reset at the end of the test and wait for another test.
The receiver output is shown below:

broker-stress-test

download

Broker Up Checker

Checks a list of brokers to see if they are up and responsive. The tool attempts to connect to a list of brokers on a periodic basis.

It reports slow or down brokers on a topic that you can set. This can be used for notifications.

Currently logging to a file is not implemented.

You can increase the number of threads as he number of brokers that you are testing increases and the check period decreases.

A screen shot of the results is shown below:

MQTT-Broker-Checker

download

 

 

Please rate? And use Comments to let me know more

10 comments

  1. Hi Steve,

    I am trying to use the above load-test scripts, when my concurrent connections are more than 13000+ (running load scripts from same linux-server), connections are dropping saying
    connection failed:%s [Errno 98] Address already in use
    Due to this I could not able to increase the load more than above.

    1. Sorry but never tried it with so many connections I would suspect that you need to use more clients.
      rgds
      steve

    2. HiveMQ Swarm might be a viable option for you. I work there, but I’m not in sales/marketing, I just stumbled upon your post after I was linked here.

  2. Hi Steve, thanks for sharung, i would like to ask. Do you have any recommendation of MQTT benchmark tool that works with SSL/TLS (Using certificate, private key, etc)?
    Thanks

  3. Hi Steve,
    Many thanks for sharing your tools!
    is there any way to have the “Maximum Connection Tester tool” available for downloading?
    Cheers,
    Ram

      1. Thx Steve, I’m probably missing something but doesn’t the “Maximum Connection Tester” download link for windows is disabled?

Leave a Reply to steve Cancel reply

Your email address will not be published. Required fields are marked *