goodrobots / maverick-api

API backend for maverick-web
MIT License
8 stars 5 forks source link

CPU usage increases with message rate #23

Open SamuelDudley opened 6 years ago

SamuelDudley commented 6 years ago

The blocking queue in the tornado main loop chews a lot of CPU. Investigate a way to reduce this.

SamuelDudley commented 6 years ago

Possibly moving the mavros receive fn directly into the io loop may reduce usage as it would save loading and unloading a queue. We could yield on message callback and process accordingly. Still a hack as mavros isn't asynchronous.

Ideally we have an asynchronous MAVLink library that can be used yielding MAVLink messages.

SamuelDudley commented 6 years ago

The above did not help with the CPU usage, but did simplify the callback structure slightly. CPU usage goes up with subscribed data rates, leading me to believe that the majority of the CPU usage is in encoding + sending the data via web sockets to the client