
I couldn't think of a better title for this question... Does anyone have any benchmarking stats on Twisted/TwistedWeb/Nevow in comparison to Apache's mod_perl, mod_python or (gasp) php for general tasks? You know, basic stuff like serving static pages, generating dynamic pages out of thin air, and generating dynamic pages off of parsed templates. I haven't seen comparison figures anywhere. I assume twisted stacks up impressively -- when I noticed template files being read each page generation, I started to think about efficiency, disk access and caching -- and hoped there were some numbers that could educate me.

Jonathan Vanasco [Thu, Apr 15, 2004 at 01:54:25PM -0400]:
I couldn't think of a better title for this question...
That's really sad. How about "Twisted Web performance benchmarks" ? Perhaps you're spending too much time reading slashdot...
Does anyone have any benchmarking stats on Twisted/TwistedWeb/Nevow in
Twisted, Twisted Web and Nevow are 3 totally different products. What do you want to benchmark and compare?
comparison to Apache's mod_perl, mod_python or (gasp) php for general tasks?
What is a "general" task?
You know, basic stuff like serving static pages,
Use 2 machines and ab (apachebench) utility from apache package. I am pretty sure, that in some conditions you could come out with suprising results. Check out http://www.eecs.harvard.edu/~mdw/proj/seda/ site, for example - as they claim to be event-driven architecture in Java, which outperforms Apache, I suppose they did some benchmarks.
generating dynamic pages out of thin air, and generating dynamic pages off of parsed templates.
I don't think, that topic like 'generating dynamic pages' is compareable between languages until you come up with a strict definition of that page. -- m

On Thu, Apr 15, 2004 at 01:54:25PM -0400, Jonathan Vanasco wrote:
I couldn't think of a better title for this question...
Does anyone have any benchmarking stats on Twisted/TwistedWeb/Nevow in comparison to Apache's mod_perl, mod_python or (gasp) php for general tasks?
You know, basic stuff like serving static pages, generating dynamic pages out of thin air, and generating dynamic pages off of parsed templates.
I haven't seen comparison figures anywhere. I assume twisted stacks up impressively -- when I noticed template files being read each page generation, I started to think about efficiency, disk access and caching -- and hoped there were some numbers that could educate me.
I'm going to give you straight answers, because I really don't believe in beating around the bush. I could give you curvy twisty statements that made you feel better about using twisted instead of apache while avoiding all figures, or I could lie to you with statistics by picking only the ones that are favourable. In short, twisted is slower than apache. This is a truth that you (and we) should acknowledge. Apache is a very mature web server that has stood the test of time. Its not the fastest and its not the best, but its pretty darn good. mod_php and mod_perl are blindingly fast. I can run simple mod_php scripts faster than i can serve static files with twisted. Twisted AND apache are still faster than the average connection. Serving static files on a modest 800mhz machine gives me apache being twice as fast as twisted, but twisted was able to pump through 12meg/second. If you have a connection that exceeds 12meg/second transfers upstream, can you please contact me regarding getting an account. Serving woven was incredibly slow, so much so that with -n 1000 -c 100 in ab (apachebench) I actually got a timeout. (I was serving a DirectoryListing). So, in face of all this? Should we use twisted? DEFINATELY. Twisted seriously cuts down on required development time for achieving results with certain types of applications, especially applications that trancend the web model. Anything stateful, anything that wants to integrate with other protocols, anything that has long running processing (defer and pickup the result several page views later, YES PLEASE!). Also, a while back i did develop a caching mechanism for woven pages that allowed me to increase pageload speed by about 10fold. I think I've still got the code laying around somewhere, it was rather simple and very effective - based on the existing concept of woven models notifying objects of when they change you could invalidate the cache and regenerate on the next pageload. Regards, Stephen Thorne.

Thanks for the input! I've been working on this one project in my spare time for 3 years now -- an online concerts database, cross-referencing cities artists genres venues, everything you could imagine, and sending weekly emails based on your interests. I got it up and running, pretty quickly, in php/mysql 3 years ago -- except it was ungodly slow. Part because of poor design on my fault, part because of the tools I chose. Two years ago, I recoded it into procedural perl and made a lot of headway in optimizing it. One year ago, I recoded it into object oriented perl under mod_perl, and had even bigger gains in speed and use. About the same time though, I started using Python a lot more. Now, I rarely use anything else. So I'm trying to code it again, in twisted and postgres, for a few reasons: 1 - i could touch perl a whole lot less, and deal with more readable/editable code that i write way faster 2 - i didn't like the memory usage of what I had under mod_perl (likely because of my errors, but twisted would be more strict and make me keep in line) -- having a single daemon that handles all the code just seems smarter and more efficient. I'd be interested in your approach to caching. While the bulk of what I see this project going is dynamic, certain elements and templates are static -- and the constant reading off of disk seems excessive. On Apr 15, 2004, at 7:51 PM, Stephen Thorne wrote:
I'm going to give you straight answers, because I really don't believe in beating around the bush. I could give you curvy twisty statements that made you feel better about using twisted instead of apache while avoiding all figures, or I could lie to you with statistics by picking only the ones that are favourable.
In short, twisted is slower than apache. This is a truth that you (and we) should acknowledge. Apache is a very mature web server that has stood the test of time. Its not the fastest and its not the best, but its pretty darn good.
mod_php and mod_perl are blindingly fast. I can run simple mod_php scripts faster than i can serve static files with twisted.
Twisted AND apache are still faster than the average connection. Serving static files on a modest 800mhz machine gives me apache being twice as fast as twisted, but twisted was able to pump through 12meg/second. If you have a connection that exceeds 12meg/second transfers upstream, can you please contact me regarding getting an account.
Serving woven was incredibly slow, so much so that with -n 1000 -c 100 in ab (apachebench) I actually got a timeout. (I was serving a DirectoryListing).
So, in face of all this? Should we use twisted?
DEFINATELY. Twisted seriously cuts down on required development time for achieving results with certain types of applications, especially applications that trancend the web model. Anything stateful, anything that wants to integrate with other protocols, anything that has long running processing (defer and pickup the result several page views later, YES PLEASE!).
Also, a while back i did develop a caching mechanism for woven pages that allowed me to increase pageload speed by about 10fold. I think I've still got the code laying around somewhere, it was rather simple and very effective - based on the existing concept of woven models notifying objects of when they change you could invalidate the cache and regenerate on the next pageload.
Regards, Stephen Thorne.
_______________________________________________ Twisted-web mailing list Twisted-web@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web

On Fri, Apr 16, 2004 at 01:05:06AM -0400, jonathan vanasco wrote:
I'd be interested in your approach to caching. While the bulk of what I see this project going is dynamic, certain elements and templates are static -- and the constant reading off of disk seems excessive.
Note that reading off the disk itself is often not the problem -- given enough RAM, the OS will automatically have files cached most of the time. More likely to be a significant cost is repeated parsing of those templates... caching the parsed objects in python can help there, or even storing pickles of stored templates and reading them in with cPickle might help in some circumstances (or might be worse...). In short, if your app isn't fast enough, profile to find the bottleneck. Until then, speculation is mostly futile, and probably wrong. The advantage of python is you can have a working app much much sooner than with e.g. C, which gives you much more time to properly profile for bottlenecks and think of ways to overcome them. -Andrew.

On Fri, Apr 16, 2004 at 03:22:34PM +1000, Andrew Bennetts wrote:
In short, if your app isn't fast enough, profile to find the bottleneck. Until then, speculation is mostly futile, and probably wrong. The advantage of python is you can have a working app much much sooner than with e.g. C, which gives you much more time to properly profile for bottlenecks and think of ways to overcome them.
Just as a note - I did and I found and I fixed. I always advocate finding performance issues before fixing perforamnce issues, and I hit people on the head when they get it the wrong way around. Regards Stephen Thorne.

On Fri, Apr 16, 2004 at 01:05:06AM -0400, jonathan vanasco wrote:
I'd be interested in your approach to caching. While the bulk of what I see this project going is dynamic, certain elements and templates are static -- and the constant reading off of disk seems excessive.
http://thorne.id.au/users/stephen/software.html Trash-0.3.0 uses CachePage, have a look at how it works. I don't think the code runs at the moment, it was written a long time ago and things have changed. Stephen.

yeah, i tried getting it to run a while back. it doesn't like twisted right now. On Apr 16, 2004, at 1:37 AM, Stephen Thorne wrote:
On Fri, Apr 16, 2004 at 01:05:06AM -0400, jonathan vanasco wrote:
I'd be interested in your approach to caching. While the bulk of what I see this project going is dynamic, certain elements and templates are static -- and the constant reading off of disk seems excessive.
http://thorne.id.au/users/stephen/software.html
Trash-0.3.0 uses CachePage, have a look at how it works.
I don't think the code runs at the moment, it was written a long time ago and things have changed.
Stephen.
_______________________________________________ Twisted-web mailing list Twisted-web@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web
participants (5)
-
Andrew Bennetts
-
jonathan vanasco
-
Jonathan Vanasco
-
Michal Pasternak
-
Stephen Thorne