[Twisted-web] Performance of twisted web with HTTP/1.1 vs. HTTP/1.0

Jason Sibre twisted-web@twistedmatrix.com
Wed, 17 Mar 2004 11:02:54 -0600


Hi folks,

I'm using Quixote, and have recently started using Twisted instead of/in
addition to Medusa to add SSL support to a web app.

Ever since doing so, I've had the feeling that Twisted was slower than
Medusa, but whenever I ran profiles of the app using ab (apache bench), the
numbers indicated that twisted was comparable to medusa (a little slower,
but only very slightly, and not enough that I should notice it 'seat of the
pants', and not surprising considering it seems to be a more robust
implementation).

Today I noticed the problem again, (on a page that had lots of little icon
type images) and decided that I *wasn't* going insane, it was definitely
slower.  Some more ab tests, and performance looked comparable to Medusa.
Mind you, even though I'm adding Twisted because I want the SSL support, my
tests are not using that SSL.  In fact, at one stage, I even removed the
code from my start script that enabled SSL to make sure that wasn't the
problem.

ab uses HTTP/1.0 to test an app, and of course most browsers use HTTP/1.1.
I set up another, more sophisticated, test suite (ACT), where I could
control the protocol, and ran the tests through it, and I confirmed that the
protocol level was definitely the culprit.

I ran the test using HTTP/1.0, and again using HTTP/1.1 (nothing else
changed).  Using HTTP/1.0, twisted served a small image about 131 times per
second, but using HTTP/1.1 it dropped to about 5 requests per second.  Yes,
"Five."

Has anyone else seen this type of behavior?  Any ideas if it's something I
may be doing wrong, or is this a known issue with Twisted?

I'm running Twisted 1.2.0 (latest stable release) on Linux with Python 2.3.3
and have looked in the archives of twisted-web and twisted-users, and
haven't seen anything about this.

I'm not a member of this list, so if you have a reply, please cc me
directly.

Thanks,

Jason Sibre