[Zope-dev] Streaming Response

Toby Dickenson tdickenson@geminidataloggers.com
Thu, 24 Apr 2003 10:41:02 +0100


(caution; old thread)

On Monday 21 April 2003 2:51 pm, Chris Withers wrote:
> Dieter Maurer wrote:
> >  > If the whole thing is indeed loaded into memory, then it pretty much
> >  > defeats the purpose of this code.

One purpose of this code is to reduce latency by allowing the first chunk to 
be written to the http socket before the last chunk is loaded from disk.

> > Change it to:
> >
> >        while data is not None:
> > 	     RESPONSE.write(data.data)
> > 	     ndata= data.next
> > 	     data._p_deactivate()
> > 	     data= ndata
>
> Has anyone tested this works?
>
> If so, has anyone checked it in?
>
> If not, could someone open a collector issue so I can check it in ;-)

Deactivating *every* block looks like a bad idea. This defeats the in-memory 
cache that will be a big win for small files. 

The memory cache is only a disadvange if your files are large enough that they 
have enough chunks to disrupt LRU cache policy. How about comparing the 
number of chunks to a fraction of the cache target size?

(sorry, no patch today. Ive a large email backlog to clear)

-- 
Toby Dickenson
http://www.geminidataloggers.com/people/tdickenson