bluerobotics / mavlink-server

Ultimate MAVLink server, with support to: REST API, WebSocket, UDP, TCP, Serial, TLog and more!
MIT License
10 stars 4 forks source link

UDP Server driver performance is below expectations #58

Closed joaoantoniocardoso closed 3 weeks ago

joaoantoniocardoso commented 3 weeks ago

On BlueOS, the latency gets too high when the data flow via MAVLink2Rest is high, which is using UDP Server. If we change the MAVLink2Rest to the UDP Server, the problem doesn't happen, proving the problem relies on the mavlink-server's UDP Server implementation.

How to reproduce it (google-chrome):

  1. Enable SITL
  2. Open http://192.168.2.2/vehicle/endpoints
  3. Switch to MAVlinkRouter (as a baseline)
  4. Measure the loading time for http://192.168.2.2/vehicle/setup/overview: ~5.4 seconds
  5. Open http://192.168.2.2/vehicle/endpoints
  6. Switch to MAVLink-server
  7. Measure the loading time for http://192.168.2.2/vehicle/setup/overview: greater than 120 seconds

In a short investigation, the problem seems to be the time contention on the clients RWLock.

joaoantoniocardoso commented 3 weeks ago

@Williangalvani

https://github.com/user-attachments/assets/23f5c070-a664-4ca4-a3f9-3f2457120412