MQTT stands for Messaging Queue Telemetry Transport, is an IoT protocol that uses the Publish-Subscribe model, which contrasts with HTTP’s handshake method of connection establishment.
MQTT has three important components:
- Publisher – A device that publishes messages at certain intervals
- Subscriber – A device with receives messages when certain conditions are met
- Broker – A software that manages the connection between publisher and broker
Another important topic to understand in MQTT is topic filtering. A publisher pumps messages to a certain topic. One or more subscribers can then subscribe to the topic and all messages pushed to the topic are received at the subscriber end. Broker facilitates the message transfer between publisher and subscriber.
Jmeter offers the plugin to capture communications over the MQTT protocol. This plugin offers four samplers to JMeter, which provide communication over MQTT:
- Connect sampler enables a user to initiate an MQTT server connection on behalf of a device. It can also be used to simulate connections without any data transmission but by sending regular heartbeat signals.
- Pub sampler enables a user to publish messages to the target MQTT server based on the business flows.
- Sub sampler enables the user to subscribe to topics and messages from the target MQTT server.
- DisConnect sampler enables a user to disconnect the connection to the server
With the above MQTT samplers, combined with JMeter’s flexible test controls, we can develop various test scenarios like simulating the devices, interacting calls/requests between the devices and sensors, and creating and sending messages.
One must ensure the message sequence is simulated from the tool and co-relates the message frequency for the required device load. Also, make sure notifications, requests, and responses are sent and received in a format and the performance metrics like response time, throughput, errors are monitored.
While the load test is in process, collect the server-side metrics across the web, DB, app layer to identify the possible bottlenecks. Players like Blazemeter, Copper, Neoload, Smartbear Load UI, MQTTbox are some of the common names that offer MQTT performance test plugins.
We also worked with one of our clients recently on this technology that involved performance testing of a product based on MQTT protocol. Still have questions or looking for more information, contact us and our experts will be happy to assist you.
By: Balaji Ponnada