i'm tryingbto convert CAN-BUS messages to a JSON based data format.Everything works just fine if don't send messages too quickly but if i replay a trace of a CAN-BUS at full speed Node Red just aborts with the following error from systemctl status node-red.service . it seems like amemory issue but i don't have a clue where to begin
If the rate you are asking for data is greater than the rate at which you are able to process the data then you may get data backed up in node red waiting to be serviced. That can lead to running out of memory.
Are you able to monitor the rate that the data are coming out of the end of your flow to see if it is keeping up?
Think of this as a data processing (like ETL) task. Now think about the "thing" between your data stream and the CAN hardware as being a funnel. If you poor too much too fast into the funnel, it will overflow.
To put it another way, if (on average) it takes 5 milliseconds to perform a transmission from Node-RED to the physical device, there is no point in hammering it with a burst stream of 19000 (or 2000 or 50000) continuous records, they will ultimately be backed up somewhere and will still take 5ms with or without the delay node. Even using rate limiting may not solve this entirely (since the delay node will hold the messages in a queue) but it might be better as you dont know what is happening in the CAN BUS nodes (are they building complex classes?, parsed packets? duplicating data?, storing on file? etc etc) whereas the delay node will simply queue exactly what you send to it in memory. So, if all 19000 records are approx 125 bits (~8bytes) then 19000*8 == 152KB (not huge)
Ultimately, you may need to look at scaling this horizontally and reducing the load on your node-red server.
i tried to rate limit to 1 message every 5 seconds but that also doesn't work. the bottleneck is probably the massive amount of json i'm trying to insert the values in.mmh i will need to get creative .