I have a python script that is a http-server: http://paste2.org/p/89701, when benchmarking it against ApacheBench (ab) with a concurrency level (-c switch) that is lower then or equal to the value i specified in the socket.listen()-call in the sourcecode everything works fine, but as soon as put the concurrency level in apache bench above the value in the socket.listen()-call performance drops through the floor, some example:
- socket.listen(10) and ab -n 50 -c 10 http://localhost/ = 1200req/s
- socket.listen(10) and ab -n 50 -c 11 http://localhost/ = 40req/s
- socket.listen(100) and ab -n 5000 -c 100 http://localhost/ = 1000req/s
- socket.listen(100) and ab -n 5000 -c 101 http://localhost/ = 32req/s
Nothing changes in the code between the two calls, I can’t figure out what is wrong - been at this problem for one day now. Also note that: The multiplexing version of the same code (I wrote to compare to the threaded version) works FINE no matter what socket.listen() is set to or what the concurrency (-c switch) in apache is set to.
I've spent a day on IRC/python docs, posted on comp.lang.python and on my blog - I can't find ANYONE that even has an idea what could be wrong. Help me!