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

Philipp von Weitershausen philipp at weitershausen.de
Fri Dec 30 13:44:19 EST 2005


Shane Hathaway wrote:
> 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.

Interesting. Where exactly did this effort of making write() fast go
into? Looking at X3 3.0's response.write() method, I basically see:

    def write(self, string):
        self._outstream.write(string)

So using write() once doesn't at all seem like an advantage over simply
returning the data...

Philipp


More information about the Zope3-dev mailing list