[Zope3-dev] Re: URGENT RFC: Is anyone using response.write in Zope 3?

Shane Hathaway shane at hathawaymix.org
Fri Dec 30 13:34:17 EST 2005


Philipp von Weitershausen wrote:
>   page 204, Example 12.24, line 17: Using the ``write()`` method of
>   HTTP-based responses does not provide a performance advantage in
>   Zope X3 3.0 and 3.1 and is not supported anymore in Zope 3.2 and
>   higher.

I would like to point out that response.write() originally did provide 
an advantage by transparently putting large output into a temporary file 
rather than holding it in RAM.  This is a performance advantage for 
highly concurrent sites sending multiple megabytes over relatively slow 
links, since it allows precious database threads to be freed while the 
kernel optionally pages out the response until the client finishes 
downloading.

However, the original response.write() does not provide a performance 
advantage in most situations because the original write() API pushes 
data; the data has nowhere to go except some temporary storage until the 
client is ready for it.  Temporary storage is somewhat expensive. 
Pulling data instead is likely to provide a performance benefit in more 
situations.

So I fully agree that the original write() should go (in fact I suppose 
it's gone already), but to say there was no performance advantage is 
imprecise.  I spent a fair amount of time making write() fast, with some 
success.

Shane


More information about the Zope3-dev mailing list