moelha / PiX

Rocket flight recorder based on Raspberry Pi Zero W
54 stars 5 forks source link

MQTT too slow #1

Open moelha opened 6 years ago

moelha commented 6 years ago

MQTT protocol is found to be too slow for real-time communication.

When the Python script reads from the sensor and sends the data to Node-RED, the data displayed on the dashboard is showed with a consistent delay.

This might be either that Node-RED is too slow to show data in real time, or that the MQTT protocol is inappropriate for this fast, real-time communication.

In order to accurately determine the reason, the following tests will be made:

  1. Create a function on Node-RED to generate random numbers and display them on the dashboard (to rule out the MQTT delay factor)
  2. Swap MQTT protocol with WebSocket (to check if speed improves)
moelha commented 6 years ago

After a series of tests on Node-RED, it was ruled out that MQTT was the actual bottleneck. An inject node was used to generate timestamps and print them on the dashboard, where the sensor data is.

There are consistent delays with fast data (aka a data point every 0.01 seconds). Node-RED is therefore too slow processing and rendering the data on the dashboard in real time.

At this point, the most important thing is data-logging, streaming is secondary. In the near future, other means of faster data-displaying will be evaluated.

moelha commented 6 years ago

The issue was re-opened so that any updates about this issue will be posted here.