RabbitMQ / MQTT Performance Testing

I have successfully configured a RabbitMQ cluster that supports MQTT through the MQTT plugin. At the moment, MQTT messages are exchanging a topic that is tied to a work queue. Thus, all MQTT messages are stored in this work queue.

Now I want to check the input performance of this cluster by examining the graphs in the RabbitMQ management plugin. My plan was to create 2 NodeJS MQTT publishers canceling many MQTT messages in a for loop, but that fails.

When the for loop runs more than 3,000 times, not all messages survive ... (Find my test code below). I would like to receive your opinion on this subject:

  • What could be the reason the messages do not survive?
  • What is the best way to evaluate the performance of RabbitMQ / MQTT?
  • Should I use multiple publishers?

code:

var quantity = 3000; var mqtt = require('mqtt'); var options = { host: 'localhost', port: 1883, protocolId: 'MQIsdp', rejectUnauthorized: false, protocolId: 'MQIsdp', protocolVersion: 3 }; var client = mqtt.connect(options); for(var x=0; x<quantity; x++) { client.publish('/WSN/N536,563E/dynamic',"22"); console.log(x); } client.end(); 
+5
source share
1 answer

The message is packed into a stream socket, and the actual data bytes are somewhere in the path: [your code] => [client buffer memory] => [send-socket socket buffer] => [socket buffer recv-system] => [code server].

If you use localhost, the probability of having a socket buffer for 3K messages is minimal, but exists.

I am not very familiar with the mqqt nodeJS client, but if it executes client.end() with a socket shutdown operation, it is possible that some mqtt frames just do not reach your server.

You have several options for your test, for example:

  • sleep a little before client.end() ,
  • use QoS = 1 message, yet you have a chance to lose some unused bytes, depending on the configuration of the mqtt window size;
  • use smth more suitable, you can google for "mqtt load generator" for samples
0
source

All Articles