Tony McDonald wrote:
A lurker surfaces.... [big snip] But now things get interesting. If you use 'ab' on the following External Method
import time
def sleep(self): time.sleep(5)
You find this as you increase the concurrency (this is on a server with 4 threads running)
% ab -c1 http://host/sleep Time taken for tests: 5.030 seconds % ab -c2 http://host/sleep Time taken for tests: 5.034 seconds % ab -c3 http://host/sleep Time taken for tests: 5.034 seconds % ab -c4 http://host/sleep Time taken for tests: 5.040 seconds % ab -c5 http://host/sleep Time taken for tests: 5.050 seconds % ab -c6 http://host/sleep Time taken for tests: 5.038 seconds
?? The last two tests imply that there's more than one thread running, but wait - look at the access_log from the server
host - - [25/Feb/2002:13:53:13 +0000] "GET /sleep HTTP/1.0" 200 45 host - - [25/Feb/2002:13:53:13 +0000] "GET /sleep HTTP/1.0" 200 45 host - - [25/Feb/2002:13:53:13 +0000] "GET /sleep HTTP/1.0" 200 44 host - - [25/Feb/2002:13:53:13 +0000] "GET /sleep HTTP/1.0" 200 45 host - - [25/Feb/2002:13:53:18 +0000] "GET /sleep HTTP/1.0" 200 45 host - - [25/Feb/2002:13:53:18 +0000] "GET /sleep HTTP/1.0" 200 45
The first four threads are kicked off, then two more (after 5 seconds). Apache bench returns after the first four threads have run - I have no idea why this is.
try ab -c 7 -n 7 URI ab will return after it has recieved the number of requests specified with -n, default is 1. It will also only do the statistics about the number of requests you configured, i.e. one in your case. You should redo the tests. FWIW, I did this test on a linux box, here's the result (with zope's standart 4 threads)
ab -c 20 -n 20 http://localhost:30080/sleep
This is ApacheBench, Version 1.3c <$Revision: 1.38 $> apache-1.3 Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Copyright (c) 1998-1999 The Apache Group, http://www.apache.org/ Server Software: Zope/Zope Server Hostname: localhost Server Port: 30080 Document Path: /sleep Document Length: 0 bytes Concurrency Level: 20 Time taken for tests: 25.085 seconds Complete requests: 20 Failed requests: 0 Total transferred: 3600 bytes HTML transferred: 0 bytes Requests per second: 0.80 Transfer rate: 0.14 kb/s received Connnection Times (ms) min avg max Connect: 31 64 78 Processing: 5023 14997 24997 Total: 5054 15061 25075 I get what one would expect. Btw. zope logs at the end of the transaction (more or less), at least not at the beginning. cheers, oliver