wiseman / mavelous

multi-platform ground station for drones that speak the MAVLink protocol
MIT License
168 stars 85 forks source link

Server problems with concurrent connections #14

Closed pchickey closed 12 years ago

pchickey commented 12 years ago

I notice that the more clients I connect to the mavelous server, it can be very slow to load HTML/JS resources for new clients.

I suspect this is because the SimpleHTTPServer we're using doesn't deal with concurrent connections well (or at all?). I'm not too hot with python, but maybe you could look into this, John?

osmogr commented 12 years ago

Would switching out the http stuff to a more robust httpd help? Then you would not have to deal with the http side and could focus on the app itself?

Have a front end web app and back end daemon which handles tcp / serial io / logging / etc?

wiseman commented 12 years ago

I think Pat has it, SimpleHTTPServer is a basic, non-multithreaded server. And I've seen the same poor performance.

I think we could switch to using CherryPy or Flask and get better performance, and gain some potentially useful features (off the top of my head: caching, sessions, authorization, templating).

wiseman commented 12 years ago

I ported the server to use the CherryPy WSGI server, which is supposed to have good performance, and Flask app support. It's on the cherrypy branch.

I haven't evaluated it yet to see if performance is any different.

You'll have to install flask and cherrypy to try it.

wiseman commented 12 years ago

I've merged this into master.

PageSpeed Insights rated the old version as a 0 out of 100, and rates the new version at 47 out of 100.

pchickey commented 12 years ago

New version looks great to me. The startup time is dramatically faster as well - it used to take about 4-5 seconds to start the server (before launching the browser) and now it is nearly instantaneous.