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

Jim Fulton jim at zope.com
Sat Dec 31 01:46:56 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.

I could certainly find evidence that you tried, but the implementation was
actually buffering data in a string buffer until the request was finished.
This was the case at least as early as spring of 2004.

Perhaps your optimization was lost some time before that.

Jim

-- 
Jim Fulton           mailto:jim at zope.com       Python Powered!
CTO                  (540) 361-1714            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org


More information about the Zope3-dev mailing list