what do you mean by "transited"? To another node? to an external thing (via MQTT? HTTP? TCP/UDP? PLC?)
Internally, messages are passed by reference when passed out to a single wire and should be near instantaneous. If you have multiple wires coming out of a node, then it is cloned for the 2nd, 3rd, nth wire - this was a design decision when V1.0.0 was developed.
Another reason for slowdown increasing with larger payload might be the node receiving data does some heavy processing - for example, the CSV node in earlier versions of Node-RED was notoriously slow. Visibly slow when processing large CSV data.
Can you give us an idea of what "large" means? rough size of the message data?
I'm very sorry, it's difficult for me to capture an example of a certain section of the flowchart because it's too large.
I have calculated that in my process, the length of the MSG is 66.0 KB. My process carries such a large MSG, which flows through multiple function nodes, switch nodes, filter nodes, etc.
Finally, it is split through the split node and sent out using mqtt.
I tried it, but as you can see, my flowchart is very complex and there are three similar flowcharts running simultaneously. Even with the use of pseudo data, it is still difficult to extract an example flowchart,
But I can describe the purpose of my program, which is to collect data from a remote device through the modbus protocol, classify the data (such as physical quantities, alarm quantities, control variables, etc.), and then send it to the cloud platform in batches using mqtt;
In the flowchart, I used quite a few loops because I had to traverse each collected data and classify it into different arrays for storage.
At the same time, there is indeed a situation where multiple wires are led out from one node.
You have a LOT of nodes that have two wires, one of which is a debug. Try removing a load of them and see if that helps. Normally, such detailed debug nodes are useful when developing a specific section of your flow but should then be removed to avoid the processing that Steve has mentioned where multiple wires coming out of the same output port force Node-RED to make a deep copy of the msg data and this is an expensive process.
Do not assume that the problem is due to the large message size, it may well be due to what you are doing with the processing of the message in the nodes where you process it.
How many messages per second is your system handling?
I trigger an inject every 7 seconds, and each trigger results in 12 rounds of data collection, parsing, and reporting.
The process by which I became skeptical about the size of the msg is as follows:
My original msg was even larger, possibly more than twice the size of 66KB. At this time, my CPU usage was almost fixed at 110% (my system has a 4-core processor), and all node were running very slowly, taking almost 40 seconds to report data.
Later, I accidentally delete a large portion of unused fields during the transfer process and found that the CPU's duration of maintaining 110% was shortened, with most of the time between 50% and 80%. At the same time, the entire flowchart can be completed within 5 seconds.