Hi, I would like to know what is the use of implementing the Zpublisher.Iterators.IStreamIterator on the object returned as the body of a HTTP response. As far as I could read the Zope code (Zserver, etc), this will make the response data to be sent 64k at a time. So will this improve performance/concurrency in any way for >64k data HTTP responses? Thanks. Pascal ********************************************************************** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses. www.mimesweeper.com **********************************************************************
The point of stream iterators is not the chunk size, but that they are handed to Medusa (ZServer) right away. As a result the Zope thread is immediately freed to serve new requests, while ZServer takes care of streaming the data to the client. Stefan On 29. Sep 2006, at 15:14, Pascal Peregrina wrote:
Hi,
I would like to know what is the use of implementing the Zpublisher.Iterators.IStreamIterator on the object returned as the body of a HTTP response.
As far as I could read the Zope code (Zserver, etc), this will make the response data to be sent 64k at a time.
So will this improve performance/concurrency in any way for >64k data HTTP responses?
-- Anything that, in happening, causes itself to happen again, happens again. --Douglas Adams
See also http://www.zope.org/Wikis/DevSite/Proposals/ FasterStaticContentServing On Sep 29, 2006, at 10:48 AM, Stefan H. Holek wrote:
The point of stream iterators is not the chunk size, but that they are handed to Medusa (ZServer) right away. As a result the Zope thread is immediately freed to serve new requests, while ZServer takes care of streaming the data to the client.
Stefan
On 29. Sep 2006, at 15:14, Pascal Peregrina wrote:
Hi,
I would like to know what is the use of implementing the Zpublisher.Iterators.IStreamIterator on the object returned as the body of a HTTP response.
As far as I could read the Zope code (Zserver, etc), this will make the response data to be sent 64k at a time.
So will this improve performance/concurrency in any way for >64k data HTTP responses?
-- Anything that, in happening, causes itself to happen again, happens again. --Douglas Adams
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists -http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Pascal Peregrina wrote at 2006-9-29 15:14 +0200:
I would like to know what is the use of implementing the Zpublisher.Iterators.IStreamIterator on the object returned as the body of a HTTP response.
As far as I could read the Zope code (Zserver, etc), this will make the response data to be sent 64k at a time.
So will this improve performance/concurrency in any way for >64k data HTTP responses?
The alternative to returning a stream iterator is to use "response.write" (or to return the file content as a string which takes quite a bit of RAM for large files). If the response length is sufficiently high, then "response.write" will work with an intermediate temporary file. This temporary file can be optimized out when you return a stream iterator. -- Dieter
Thanks for all the replies... So I will continue to investigate this for my specific object responses, because I like what Stefan says (the Zope thread being freed earlier, meaning that next waiting request will be accepted earlier, etc). This should improve a little concurrency. Currently my product was sending the whole HTML code of the page as a string... Pascal
De : Dieter Maurer <dieter@handshake.de> Date : Fri, 29 Sep 2006 19:29:39 +0200 À : Pascal Peregrina <Pperegrina@Lastminute.com> Cc : "zope@zope.org" <zope@zope.org> Objet : Re: [Zope] HTTPResponse
Pascal Peregrina wrote at 2006-9-29 15:14 +0200:
I would like to know what is the use of implementing the Zpublisher.Iterators.IStreamIterator on the object returned as the body of a HTTP response.
As far as I could read the Zope code (Zserver, etc), this will make the response data to be sent 64k at a time.
So will this improve performance/concurrency in any way for >64k data HTTP responses?
The alternative to returning a stream iterator is to use "response.write" (or to return the file content as a string which takes quite a bit of RAM for large files). If the response length is sufficiently high, then "response.write" will work with an intermediate temporary file. This temporary file can be optimized out when you return a stream iterator.
-- Dieter
********************************************************************** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses. www.mimesweeper.com **********************************************************************
participants (4)
-
Chris McDonough -
Dieter Maurer -
Pascal Peregrina -
Stefan H. Holek