thingsboard / thingsboard-gateway

Open-source IoT Gateway - integrates devices connected to legacy and third-party systems with ThingsBoard IoT Platform using Modbus, CAN bus, BACnet, BLE, OPC-UA, MQTT, ODBC and REST protocols
https://thingsboard.io/docs/iot-gateway/what-is-iot-gateway/
Apache License 2.0
1.72k stars 829 forks source link

[HELP]CPU usage is too high, sometimes exceeding 100% #272

Closed lesliechung88 closed 4 years ago

lesliechung88 commented 4 years ago

Describe the issue

The CPU usage is too high, sometimes exceeding 100%. What causes it? Can it be optimized?

only run MQTT Connector

imbeacon commented 4 years ago

Hi @lesliechung88

Thank you for your interest in ThingsBoard IoT gateway and feedback, I will investigate and optimize processing.

imbeacon commented 4 years ago

Hi @lesliechung88

I researched and added some improvements, but processing requires CPU to increase speed. When processing data, the gateway can use almost all available resources to process incoming data. After the data has been processed, the processor load will become equal to 1-2 percent.

marcozanghi commented 2 years ago

@zbeacon, I am experimenting the same 100% cpu usage but also when all the connectors are disabled and thingsboard-gateway only connects to the thingsboard server. Do you have any idea how to set a limitation this requirement by a specific configuration (available cpu resources) and if it is possible? image

abalmos commented 2 years ago

@zbeacon I am also seeing this behavior. Downgrading to 2.5.5.2 brings the CPU usage to near 0. I can't easily try version in between because only 2.8 is available after 2.5.5.2 on docker hub.

AngeLinuX99 commented 2 years ago

Same problem of huge use of cpu on my docker server. I have 4 thingsboard_gateway instances and CPU is ALWAYS at 100% with 2.8 version. Im going to test 2.9

AngeLinuX99 commented 2 years ago

Same problem of huge use of cpu on my docker server. I have 4 thingsboard_gateway instances and CPU is ALWAYS at 100% with 2.8 version. Im going to test 2.9

Same CPU problem in version 2.9

abalmos commented 2 years ago

Hi @lesliechung88

I researched and added some improvements, but processing requires CPU to increase speed. When processing data, the gateway can use almost all available resources to process incoming data. After the data has been processed, the processor load will become equal to 1-2 percent.

@zbeacon can we please re-open this issue? The expected behavior you described is not what we are experiencing. I see a near constant 100% CPU usage regardless of input data rate, in fact even when there is none.

imbeacon commented 2 years ago

@abalmos , @AngeLinuX99 ,

There were different reasons for this behavior of the gateway. Whenever the both reasons are fixed in the master branch, please try to use the version from the master branch, probably we will publish a minor release in few days with fix for this behavior.

ferguscan commented 2 years ago

Hi,

I am experiencing this issue, and I use Thingsboard IoT Gateway via Docker. Will the official Docker image be updated to include this fix? I see the image was last updated two months ago: https://hub.docker.com/r/thingsboard/tb-gateway/tags

Thanks!