Thursday, November 17, 2022

How to scale your MQTT lab to 1000 sensors in minutes

TL;DR Money saved: $40,000. Time saved: immeasurable.

We needed to create a MQTT lab with 1000 sensors to test a subscriber client with
realistic telemetry. The open-source client tracks any key value, and alerts if any
arbitrarily pre-selected value exceeds a threshold.

We bought 1 real Shelly Plus H&T sensor for $40.

After you have configured it, it sends MQTT messages to the broker, but only 
every time the temperature and humidity changes. So, to test our application, we 
would have had to run to the refridgerator quite often to make it change the 
temperature.

As you can see from the screenshot


it sends JSON payloads, but very infrequently. In our case, after 6 minutes


So, every time we wanted a message, we needed to change the temperature.

To accelerate development, we used MIMIC.

First we just captured the messages with wireshark, recorded into MIMIC MQTT Simulator
and generated messages whenever and however we wanted. Rather than waiting for minutes, we can
send any message with any value in seconds, speeding up development time. Then we multiplied
the sensor 1000-fold, quickly reaching the required scalability at no additional cost.

This video shows the process in 2 minutes:


Money saved: $40,000. Time saved: immeasurable.

No comments: