I'm curious why when testing Python web server CherryPy using abwith -c 7(7 parallel streams), he can use the server 1500 requests / sec (about what I expect), but when I turn on -c 8, it drops to 25 requests / sec. I run CherryPy with numthreads = 10 (but this is no different if I use numthreads = 8 or 20) on a 64-bit four-core Windows machine with Python 2.6.
I half suspect that the Python GIL is part of the problem, but I don't know why this happens when I receive up to 8 requesting threads at once. On a quad-core machine, I expect it to change to -c 4, but it is not.
I am using the CherryPy single page web server that comes with web.py , and here is the WSGI application that I am testing against:
from web.wsgiserver import CherryPyWSGIServer
def application(environ, start_response):
start_response("200 OK", [("Content-type", "text/plain")])
return ["Hello World!",]
server = CherryPyWSGIServer(('0.0.0.0', 80), application, numthreads=10)
try:
server.start()
except KeyboardInterrupt:
server.stop()
Output abfor 7 and 8 simultaneous streams:
C:\\> ab -n 1000 -c 7 http://localhost/
...
Concurrency Level: 7
Time taken for tests: 0.670 seconds
Complete requests: 1000
Failed requests: 0
Write errors: 0
Total transferred: 130000 bytes
HTML transferred: 12000 bytes
Requests per second: 1492.39 [#/sec] (mean)
Time per request: 4.690 [ms] (mean)
Time per request: 0.670 [ms] (mean, across all concurrent requests)
Transfer rate: 189.46 [Kbytes/sec] received
C:\\> ab -n 1000 -c 8 http://localhost/
...
Concurrency Level: 8
Time taken for tests: 7.169 seconds
Complete requests: 158
Failed requests: 0
Write errors: 0
Total transferred: 20540 bytes
HTML transferred: 1896 bytes
Requests per second: 22.04 [#/sec] (mean)
Time per request: 362.973 [ms] (mean)
Time per request: 45.372 [ms] (mean, across all concurrent requests)
Transfer rate: 2.80 [Kbytes/sec] received
source
share