[Zope3-dev] Twisted / Zope

Itamar Shtull-Trauring twisted@itamarst.org
Mon, 11 Feb 2002 20:30:00 +0000


Hi all,

As the author of The Hack, I thought I'd join in. So, the facts as I see 
them:

1) Zope3 HTTP server is very likely better than Twisted's. At the very 
least Twisted's doesn't do persistent connections, a serious issue for 
browser-oriented sites. So using this code in Twisted may be a good 
idea, except we probably wouldn't because of licensing issues (don't ask :).

2) Currently, the twisted HTTP server doesn't use threads. That means 
operations can't block, so no ZEO, and RDBMS access needs to be done via 
twisted's async mechanisms. This requires some small patches to the 
Zope3 publisher, which I hope to submit soon. I may change to a 
thread-dispatching model in the future, especially if anyone ever finds 
a use for it.

3) Twisted has its own web framework, which might concievably be better 
suited to custom apps that integrate with Twisted than Zope3. But we do 
want to support ZPT in this separate framework (theft is the sincerest 
form of flattery.)

4) In terms of speed, I got 200-400 requests a second (depending on if 
it's from memory, disk, size, etc.), 30MB/sec on large files (P3/866). 
In any case, the real bottleneck in Zope is not the HTTP server, but the 
content being rendered. People keep asking if it's faster, and I keep 
telling them it's not relevant :)

5) "More object-oriented" is not necessarily good - too many layers of 
abstraction can slow you down. One thing Twisted does too that 
*asyncore* doesn't is separate between transport (TCP or SSL) and 
protocol (HTTP). And from what I can see Zope3 does that too, albeit in 
a less elegant way than Twisted (asyncore's influence still being felt).

In other words, replacing Zope3's HTTP server with twisted is rather 
premature, to say the least.

If you *do* want SMTP/IRC/whatever integration (and choose not to use 
twisted's own web framework, which would work fine for Mailman, 
certainly), then there's some merit in using Twisted. Or if you want to 
build a inteface to control Zope from a remote app (be it in Python, 
Java, or *shudder* Emacs) using Twisted's remote object protocol.