thingsboard-gateway icon indicating copy to clipboard operation
thingsboard-gateway copied to clipboard

[HELP]MPU performance requirements of ThingsBoard IoT Gateway

Open jpiwek opened this issue 9 months ago • 2 comments

-I am looking into creating a new Secure Gateway platform based on new i.mx91 / i.mx93. What is the requirement on CPU performance, RAM to run ThingsBoard IoT Gateway? -Additional add-on devices (such as Digital / Analog IO, Sensors, Actuator), will be connected to the gateway over 10BASE-T1S which is a simple switchless Single Pair Ethernet architecture using Multidrop Bus. -How many request per seconds over Modbus and MQTT can be managed by IoT Gateway?

jpiwek avatar Mar 28 '25 09:03 jpiwek

Hi @jpiwek,

Thank you for your interest in the ThingsBoard IoT Gateway!

The hardware requirements depend heavily on the expected load. Since the Gateway is implemented in Python and subject to the Global Interpreter Lock (GIL), it primarily utilizes a single CPU core. As a result, the performance of that core is more important than the number of available cores.

Memory usage also scales with load. The gateway uses internal queues to buffer incoming messages. Under heavy load, if message conversion and delivery can’t keep up, the queues may grow, which increases memory consumption.

To support additional device types, you can develop a custom connector to handle communication and data processing for those devices.

For Modbus integration, please note that devices are currently polled sequentially and each register is read individually. We plan to optimize this in a future release. The number of registers and devices you plan to poll will directly influence performance.

Regarding MQTT, performance is more dependent on the number of messages rather than the number of datapoints. For example, sending a single message with 2000 datapoints is much faster than sending 2000 individual messages with a single datapoint each.

In recent benchmarking, the MQTT connector processed approximately 5000 datapoints per second when all were packed into a single message. When sending many smaller messages, throughput dropped to around 2500 datapoints per second.

imbeacon avatar Jul 08 '25 08:07 imbeacon

@imbeacon :Thanks for the summary. few questions below. I am just asking as I am planning a with TB Edge and TB IoT Gateway running on a on RPi CM4. 3-5 devices will be connected to the Rpi via serial (80 datapoint every 1s-10s) and UDP or TCP (20-30 datapoint every 1s-10s) Connection. I will think about the message report strategy for my use case.

Q:Are there any plans to switch to Python 3.14? As far as I remember it will support real multi-threading.

Q: My serial protocol is similar to Modbus Serial but support more advanced application features such a datapoint and device discovery. We both already had a thread about it.

I would like to know how I could optimize my own serial connector to not run into the same performance issue as with Modbus Connector. I plan to start in 2-3 weeks. In my current proprietary serial driver, user selects datapoints of interest and all are read in a single thread sequentially one after another.

jpiwek avatar Jul 08 '25 11:07 jpiwek