ty4tw / AsyncMQTT-SN

MQTT-SN Async Client and Gateway for Arduino and linux.
48 stars 14 forks source link

Very high CPU load when AsyncMQTT-SN Gateway starting #1

Closed ngocphu811 closed 9 years ago

ngocphu811 commented 9 years ago

When start AsyncMQTT-SN Gateway, the CPU load was too high ( ~ 100%). Anyone has faced this issue?

ty4tw commented 9 years ago

%CPU on my laptop is 38%. I changed TIMEOUT_PERIOD 10millseconds to 10 secs. Then CPU load is now 24%.

ngocphu811 commented 9 years ago

Thank Tomoaki, I have tried to change TIMEOUT_PERIOD to 10 secs.And the CPU load is now down to below 50%.But I wonder that whether this change effects to the Gateway functionality?

ty4tw commented 9 years ago

Do not worry. Program logic is event driven, not polling. 10 secs time out of the event queue is to check the other threads terminated. if terminated, GatewayControlTask should stop.