[Twisted-Python] How to improve response time of twisted.web?

Pavel pbastov at gmail.com
Wed Mar 26 09:30:41 EDT 2008

Hi all,

I decided to benchmark my web server written in twisted against apache.

I added just one resource to my twisted web server that reads a file and
returns it to client.

Then, I created a virtual host in Apache and put the same (html) file
to the web root.

I issued the following command for both servers:

# http_load -parallel 100 seconds 5 url

First time the url contained the path to Apache document, second time
-- to twisted web.

Here is the result of the benchmark. My web server is more than 3
times slower than apache,
primarily due to response time as you can see below:

8619 fetches, 13 max parallel, 2.43918e+07 bytes, in 5.00155 seconds
2830 mean bytes/connection
1723.27 fetches/sec, 4.87684e+06 bytes/sec
msecs/connect: 0.557627 mean, 2.159 max, 0.123 min
msecs/first-response: 2.81528 mean, 7.367 max, 0.413 min
HTTP response codes:
  code 200 -- 8619

2437 fetches, 100 max parallel, 6.86601e+06 bytes, in 5.00001 seconds
2817.4 mean bytes/connection
487.399 fetches/sec, 1.3732e+06 bytes/sec
msecs/connect: 0.159532 mean, 9.453 max, 0.077 min
msecs/first-response: 197.407 mean, 230.882 max, 5.978 min
HTTP response codes:
  code 200 -- 2437

It's not that I want to outperform Apache, I'm just curious is there any way
to improve the response time in twisted?

Thanks in advance.




More information about the Twisted-Python mailing list