Ask HN: Fastest concurrent HTTP server library for Python?
For my project, I am running a high-performance web service with really long response times (~30 seconds) and high concurrency (able to do multiple requests at once without significant slowdown in response time). I am using the built-in BaseHTTPService with ThreadingMixIn right now for the web service, but it is choking with a load of even 3-4 requests per second. Apparently, the high response time is a difficult requirement, since it rules out libraries like Tornado who do a serial FIFO "one at a time" processing of requests despite being asynchronous. I looked at several libraries, and I am leaning towards syncless right now. There are many of these libraries though, and really, it comes down to the "tyranny of choice." The important thing is actually owning the server code in Python rather than having say nginx call my code for each job since I am interfacing with a device driver that needs to have an open context the entire time the server is running. This is another requirement that is pretty unique to my project. What do you suggest I use?
7 comments
[ 6.1 ms ] story [ 22.0 ms ] threadGiven a four core CPU, if each request is lasting 30 seconds without I/O, then each request is going to use 1 core. On a 4-core CPU, you would only be able to serve 4 requests within a 30 second span. What is the request doing for 30 seconds? How much of it is actual CPU-bound work and what amount is I/O.
Check out this comparison of Python servers: http://nichol.as/benchmark-of-python-web-servers