Anecdotally, here's what I saw:
* cogen had the lower relative number of page errors (i.e. dropped
connections or blank pages) of any of the servers
* cogen's response times were quite variable (high variation),
relative to the others
* nginx was amazingly stable and fast but accomplished this by
dropping a huge percentage of its connections (so, high error rates)
* apache and yaws had huge error rates and very poor throughput
The tests attempted to run 10K concurrent requests against the server,
so it was a pounding. The servers only had to provide static content.
Cogen used wsgi to output a short snippet of HTML via code.
There's obviously a ton more to quality and report here. To do it
justice, I've started a Google code project (called cloudrunner) that
can be used to a) report test results like this and b) provide the
underlying code so the tests can be easily replicated.
The goal of coderunner is to provide testing packages that can be
easily tweaked and run on Amazon's EC2. The point here is that Amazon
is excellent at spinning up servers for a short time for very little
cost. This would, at least theoretically, support a huge array of test
scenarios that could be executed by anyone with an EC2 account for
very little cost.
I'll work on getting my current load tests out there for public
consumption, replication, tweaking, etc. It might prove to be an
interesting project.
Back to the async stuff...
I don't think it's reasonable to try to generally shoe-horn existing
libraries into an asyc framework. I think we'd need to look at a new
set of light weight components that could plug into cogen or similar
servers. It's be nice to have a generalized Pythonic approach that was
not tied to a particular async implementation, though that might also
be borderline impossible. (Will read through the wsgi async thread
cited.)
I'd like to work on a small app server that thoughtfully leveraged
cogen (or other coroutine centered like weightless) and see how it
scales/performs relative to traditional wsgi and f/cgi approaches.
Would any be interested in lending a hand on this? I'd like to
showcase the ability to break an HTTP response into tiny bits,
providing library interfaces for:
* HTML generation (e.g. Cheetah, Genshi, etc.)
* Async database access
For the database stuff, would it not be possible to use events/
messages in hand offs to database operations? This would avoid the
need for specialized low level async database access drivers, which of
course no one wants to write and maintain.
For the HTML stuff, I wouldn't assume that page rendering is so fast
that it doesn't need to yield along the way. In a lot of Python apps
that I've worked with, the two long poles in the response processing
are the database access and page rendering.
It should be pretty easy in some templating libraries to hack into the
parsing and page rendering stages to introduce appropriate yields.
Garrett
On Nov 30, 1:53 pm, "Ionel Maries Cristian" <
ionel...@gmail.com>
wrote:
> Very good writeup - blogpost worthy.
>
> Speaking of typical examples - well, cogen is not for your typical web app.
> Most db connectors do not have an async interface - so I didn't bother
> making a solution like twisted.enterprise.adbapi (threadpolled wrappers
> around blocking db interfaces). However, for example, psycopg2 has an async
> interface (
http://initd.org/svn/psycopg/psycopg2/trunk/doc/async.txt) -
> something could be done in cogen.
>
> Templates should not usualy be a problem - unless ouputing huge ammounts of
> content. Using a template engine that streams the output should solve this -
> though I still have to get a chance to investigate this.
>
> On the other hand there are some typical async app examples in cogen (the
> webchat and the web irc client - done in the pylons wsgi stack) found in the
> examples dir. Hopefully in the future there might be more elaborate examples
> - or, heck, even real apps.
>
> Speaking of stress tests - have you any results ? Would be very interesting
> to see what you found out :)
>
> There's has been some discussion for making async apps work better (or at
> least in a unified way) in a wsgi stack:
http://mail.python.org/pipermail/web-sig/2008-May/thread.html#3401- the