Hi Folks,
I am learning Node-Red and already have implemented together with influxDB and Grafana for basic data acquisition purposes. I would like to also make a vehicle data logger, which require high resolution data and faster acquisition speeds (~300 sps) from CAN BUS and different acceleration sensors etc.
Now the question is, how fast Node-Red can be? I am interested in application particularly on Raspberry Pi. Is it also suitable for bandwidth heavy applications, or only for "low sample rate" IoT?
As usual it all depends. Node-RED can be fast but it depends on the amount of processing required eg database/external access and in particular the hardware it’s running on. Specifically pi before version 4 has relatively slow io. I think it would struggle with the data rates you require.
300 (sps ? what is that) messages per second (?) + I/O's to influx on a SD card, you can wait for the moment it wears out, I give it a week. Instead of dumping format it and insert it into influx, stream the data to a logfile and after your session is finished, parse it, and batch it into influx.
Why not use dedicated CANBUS software like python-can ?
With sps I mean sample per second, from all 5 sensors.
You mean, it will wear out the SD card?
Actually, I was also thinking to log the high resolution data to something like HDF5, then dump it. But I have not decided where to start and what is the correct way to do it.
I have been using Python and SocketCAN since long time ago. But my intention is also to learn new ways and make more fun projects.
I can imagine that 300sps is no issue for the pi as long as you don't write it to a (relatively slow) medium that demands back and forth I/O over a bus. If you intend to perform parsing/transforming actions on each message you will find bottlenecks along the way. I am curious how many a pi could handle - without writing
I have a dashboard which is visualising incoming data from a number of remote monitors, doing maths on 3 parts of the messages (at least 20 MQTT messages a second), and parsing the rest using function nodes and a smooth node and it shows no sign of struggling.
Easiest way to check it will be setup a few inject nodes and speed them up till it breaks.
Well it doesn't matter the count of readings per second. (OK it does but that is not the only thing to look or blame) If you are hitting some limits already (CPU 100%) then you'll need to figure out the bottleneck and try to optimize it. If you are looking for help on that, you'll need to share sample of your data and a bit flow with data manipulations and then we probably can say something reasonable or give advises about it.
Is there some know rules about incoming data? Is it guaranteed that you always have comma separated string with 5 elements? Can the data be still considered valid, if some value missing?
Did some optimizations for your function. Left in comments to explain the changes.
As I don't have any PI (or similar low performance machine) I really can't say will it help or how much it changes .
Also note that having two nodes connected to the output of a node causes Node-RED to clone the object.
So removing the debug is likely to have quite an impact.
If you really want to output a debug, might be better to use node.warn inside your function node. Though I think that the debug output panel may also not be that fast so may also have an impact (not sure though, don't hold me to that).
@TotallyInformation - re debug - yes you are right... anything you can do to not fork and not send to the side panel will speed it up - so once you are sure it is sending what you want - disconnect / remove them. (Though turning it off will stop them being sent also so that will help.)
As Dave says, turning it off will stop the debug msg being sent which helps but I think that there will still be a msg clone operation. Not 100% sure though.