Shane Hathaway wrote:
Shane Hathaway wrote:

Philipp von Weitershausen wrote:

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

The interesting part is behind the scenes. If the response is large enough (it's an adjustable threshold), the response transparently gets sent to a temporary file. If the load on the server doesn't allow all the responses to fit in RAM, temporary files are an advantage because they allow the kernel to help manage the memory. (CPython's manner of using memory makes it hard for the kernel to page most memory held by Python processes.)

Now that I've brought more of this issue back into my head, I remember that the advantage I just spoke of is independent of response.write(). However, there was still an advantage if a response is large enough that it doesn't comfortably fit in RAM. response.write() allowed the application to write the response in pieces, giving the kernel an opportunity to swap out the response data immediately rather than thrash. If Zope 2's ZServer didn't have this feature, would crawl even worse than it does now. I know this because of some debugging sessions.

You are confusing Zope 2 and Zope 3.  Zope 2's response.write
does handle large output effciently, Zope 3's did not.


Jim Fulton           mailto:[EMAIL PROTECTED]       Python Powered!
CTO                  (540) 361-1714  
Zope Corporation
Zope3-dev mailing list

Reply via email to