Using the modbus-flex-getter node to read data from multiple devices at the same time can become laggy

Hi all, I have encountered a problem:
I am using three modbus-flex-getter nodes at the same time to read data from 3 different devices from the same serial port at a frequency of 0.1 seconds, and after deployment, the process becomes laggy. I would like to know what the problem is and how to solve it.

The diagram below shows my process:


[
    {
        "id": "3e987dc6d6d73636",
        "type": "tab",
        "label": "流程 3",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "e5e13d017f01057c",
        "type": "inject",
        "z": "3e987dc6d6d73636",
        "name": "",
        "props": [
            {
                "p": "payload"
            }
        ],
        "repeat": "0.1",
        "crontab": "",
        "once": false,
        "onceDelay": "0.05",
        "topic": "",
        "payload": "",
        "payloadType": "str",
        "x": 250,
        "y": 320,
        "wires": [
            [
                "463a9587d1797c24"
            ]
        ]
    },
    {
        "id": "463a9587d1797c24",
        "type": "function",
        "z": "3e987dc6d6d73636",
        "name": "FC4 3 0 [2]",
        "func": "msg.payload = { \n    'fc': 4, \n    'unitid': 3, \n    'address': 0 , \n    'quantity': 2 \n}; \n\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 450,
        "y": 320,
        "wires": [
            [
                "43a3e6b0214a4b25"
            ]
        ]
    },
    {
        "id": "43a3e6b0214a4b25",
        "type": "modbus-flex-getter",
        "z": "3e987dc6d6d73636",
        "name": "ttySTM2",
        "showStatusActivities": false,
        "showErrors": false,
        "logIOActivities": false,
        "server": "3ab6da8a17d3a981",
        "useIOFile": false,
        "ioFile": "",
        "useIOForPayload": false,
        "emptyMsgOnFail": false,
        "keepMsgProperties": false,
        "x": 620,
        "y": 320,
        "wires": [
            [],
            [
                "b03af3575de1a54f"
            ]
        ]
    },
    {
        "id": "b03af3575de1a54f",
        "type": "modbus-response",
        "z": "3e987dc6d6d73636",
        "name": "",
        "registerShowMax": 20,
        "x": 850,
        "y": 320,
        "wires": []
    },
    {
        "id": "53bdad0500db19f9",
        "type": "comment",
        "z": "3e987dc6d6d73636",
        "name": "温湿度传感器",
        "info": "",
        "x": 450,
        "y": 280,
        "wires": []
    },
    {
        "id": "fc86a2b0533e6d19",
        "type": "function",
        "z": "3e987dc6d6d73636",
        "name": "FC4 4 0 [2]",
        "func": "msg.payload = { \n    'fc': 4, \n    'unitid': 4, \n    'address': 0 , \n    'quantity': 2 \n}; \n\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 450,
        "y": 460,
        "wires": [
            [
                "f0e9982088f1d852"
            ]
        ]
    },
    {
        "id": "f0e9982088f1d852",
        "type": "modbus-flex-getter",
        "z": "3e987dc6d6d73636",
        "name": "ttySTM2",
        "showStatusActivities": false,
        "showErrors": false,
        "logIOActivities": false,
        "server": "3ab6da8a17d3a981",
        "useIOFile": false,
        "ioFile": "",
        "useIOForPayload": false,
        "emptyMsgOnFail": false,
        "keepMsgProperties": false,
        "x": 620,
        "y": 460,
        "wires": [
            [],
            [
                "b467c4e706a78da2"
            ]
        ]
    },
    {
        "id": "b467c4e706a78da2",
        "type": "modbus-response",
        "z": "3e987dc6d6d73636",
        "name": "",
        "registerShowMax": 20,
        "x": 850,
        "y": 460,
        "wires": []
    },
    {
        "id": "bb4c4d704c5cbeae",
        "type": "comment",
        "z": "3e987dc6d6d73636",
        "name": "模拟量采集",
        "info": "",
        "x": 440,
        "y": 420,
        "wires": []
    },
    {
        "id": "00dbe25ee763ad4e",
        "type": "inject",
        "z": "3e987dc6d6d73636",
        "name": "",
        "props": [
            {
                "p": "payload"
            }
        ],
        "repeat": "0.1",
        "crontab": "",
        "once": false,
        "onceDelay": "0.15",
        "topic": "",
        "payload": "",
        "payloadType": "str",
        "x": 250,
        "y": 460,
        "wires": [
            [
                "fc86a2b0533e6d19"
            ]
        ]
    },
    {
        "id": "7ab3348e9315ba85",
        "type": "function",
        "z": "3e987dc6d6d73636",
        "name": "FC4 2 0 [2]",
        "func": "msg.payload = { \n    'fc': 4, \n    'unitid': 2, \n    'address': 0 , \n    'quantity': 2 \n}; \n\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 450,
        "y": 180,
        "wires": [
            [
                "12df0b7b154ea451"
            ]
        ]
    },
    {
        "id": "12df0b7b154ea451",
        "type": "modbus-flex-getter",
        "z": "3e987dc6d6d73636",
        "name": "ttySTM2",
        "showStatusActivities": false,
        "showErrors": false,
        "logIOActivities": false,
        "server": "3ab6da8a17d3a981",
        "useIOFile": false,
        "ioFile": "",
        "useIOForPayload": false,
        "emptyMsgOnFail": false,
        "keepMsgProperties": false,
        "x": 620,
        "y": 180,
        "wires": [
            [],
            [
                "1c28970b72d7d695"
            ]
        ]
    },
    {
        "id": "1c28970b72d7d695",
        "type": "modbus-response",
        "z": "3e987dc6d6d73636",
        "name": "",
        "registerShowMax": 20,
        "x": 850,
        "y": 180,
        "wires": []
    },
    {
        "id": "c831de9579c475d7",
        "type": "comment",
        "z": "3e987dc6d6d73636",
        "name": "数字量输入",
        "info": "",
        "x": 440,
        "y": 140,
        "wires": []
    },
    {
        "id": "345a608dc35d47ee",
        "type": "inject",
        "z": "3e987dc6d6d73636",
        "name": "",
        "props": [
            {
                "p": "payload"
            }
        ],
        "repeat": "0.1",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "str",
        "x": 250,
        "y": 180,
        "wires": [
            [
                "7ab3348e9315ba85"
            ]
        ]
    },
    {
        "id": "3ab6da8a17d3a981",
        "type": "modbus-client",
        "name": "",
        "clienttype": "simpleser",
        "bufferCommands": false,
        "stateLogEnabled": false,
        "queueLogEnabled": false,
        "failureLogEnabled": true,
        "tcpHost": "127.0.0.1",
        "tcpPort": "502",
        "tcpType": "DEFAULT",
        "serialPort": "/dev/ttySTM2",
        "serialType": "RTU-BUFFERD",
        "serialBaudrate": "9600",
        "serialDatabits": "8",
        "serialStopbits": "1",
        "serialParity": "none",
        "serialConnectionDelay": "100",
        "serialAsciiResponseStartDelimiter": "0x3A",
        "unit_id": "1",
        "commandDelay": "1",
        "clientTimeout": "1000",
        "reconnectOnTimeout": true,
        "reconnectTimeout": "2000",
        "parallelUnitIdsAllowed": true
    }
]

I need your help. Thank you all so much!

A serial port can only handle one transaction at a time. You must send the request to the first one, wait for the response, then send the request to the next one, and so on. You can do this by using the response from the first one to start the next one, and so on.

Also 0.1 seconds seems very fast to me, I suspect the devices will not keep up with that. After you have modified the flow to perform the requests in series start with, for example, 5 seconds, and make sure that works ok. Measure how long the total sequence actually takes, then you can determine how fast you can go.

Thank you very much for your answer!

In my previous tests:

  1. if I use only one of the flows, polling intervals of 0.1s are fine.
  2. then when three nodes are reading data together, the lowest interval of 0.5s I have tested is feasible.
  3. what I want to know is: if more than one modbus-flex-getter node is reading the same serial device serially, why can't it be polled at a very low interval? Is it a limitation of the node itself?

Before this, I was using a Qt program to read sensor data, and the polling interval was also 0.1s, indicating that the device supports reading at such a short interval. Recently I found out that there is a tool like node-red, so I was trying to learn and use it, and then I came across this question today.

As I said, wire them up in series then you can make it go as fast as it will go without risk of overlapping comms. It is very easy, just use the response from the first modbus node to trigger the second function node.

If you are using rs485 then you may also have to allow a short time between the transactions for the bus to switch over. If so then insert a delay node in front of the second and third function nodes.

Thank you very much! I'll try this approach tomorrow. At the moment it seems that I still lack some node-red basics and still need to keep learning.