Martin _
gzlist at googlemail.com
Sat May 19 21:28:45 EDT 2007
The two sample scripts do nothing like the same thing, compare the following: from mod_python import apache def badhandler(req): """ Bad version of sample handler for comparison Sends 1000 little packets consisting of just "Yeah" Concurrency Level: 10 Time taken for tests: 65.437500 seconds Complete requests: 1000 Failed requests: 0 Write errors: 0 Total transferred: 5176000 bytes HTML transferred: 5000000 bytes Requests per second: 15.28 [#/sec] (mean) Time per request: 654.375 [ms] (mean) Time per request: 65.438 [ms] (mean, across all concurrent requests) Transfer rate: 77.23 [Kbytes/sec] received Requests per second: 15.28 """ for i in xrange(1000): print >> req, "Yeah" return apache.OK def handler(req): """ Good version of sample handler for comparison Puts together a thousand "Yeah"s then sends them Concurrency Level: 10 Time taken for tests: 1.250000 seconds Complete requests: 1000 Failed requests: 0 Write errors: 0 Total transferred: 5198000 bytes HTML transferred: 5000000 bytes Requests per second: 800.00 [#/sec] (mean) Time per request: 12.500 [ms] (mean) Time per request: 1.250 [ms] (mean, across all concurrent requests) Transfer rate: 4060.80 [Kbytes/sec] received """ buf = [] for i in xrange(1000): buf.append("Yeah\n") req.write("".join(buf), 0) return apache.OK
|