Python Performance HTTPServer and TCPServer

I spent several days trying to get solid statistics on what performance you can expect from using the built-in HTTPServer and / or TCPServer libraries in Python.

I was wondering if anyone could give me any ideas on how or to process the serving HTTP requests, and if they can linger in production environments or in high traffic situations, and if anyone has any hints or hints that will improve performance in these situations. (Assuming there is no access to external libraries like Twisted etc.)

Thanks.

+4
source share
2 answers

None of the built-in libraries were intended for serious use. Get real implementations, for example, from Twisted, or Tornado, or gunicorn, etc. Etc. A lot of them. There is no need to stick to standard library modules.

The performance and probably reliability of the embedded libraries are poor.

+3
source

Test them out. Start showing the page on the local host, and then use the Apache comparison tool.

apt-get install apache2-utils ab -n 10000 -c 100 http://localhost/ 

This makes 10,000 requests with a maximum of 100 concurrent requests.

But yes. I would not use them in production. We serve Python applications through uWSGI with requests proxied through Nginx. It is very flexible and scalable. Can embedded httpserver handle multiple requests? This is probably single threaded. You will find out pretty quickly when you test it.

+2
source

All Articles