[Zope-dev] Streaming Response

Casey Duncan casey@zope.com
Wed, 16 Apr 2003 10:13:07 -0400


On Wednesday 16 April 2003 10:02 am, Johan Carlsson [EasyPublisher] wrote=
:
> At 09:46 2003-04-16 -0400, Casey Duncan said:
> >[snip]
> > > This could be useful for other stuff as well (except streaming larg=
e=20
> > object,
> > > which should never be saved in the ZODB by the way, be cause it blo=
ats=20
the
> > > memory when the object is loaded. It should be stream from a file, =
and=20
not
> > > by reading the entire file as most file system object product I rev=
iewed
> >does
> > > including LocalFS which I have made a patch for).
> >
> >Just FYI: Zope file objects are not completely loaded into memory when=
 they
> >are accessed (and served). They are divided into 64K chunks in the ZOD=
B
> >(where each chunk is an individual record). Files > 64k are streamed u=
sing
> >response.write() when they are served. Files smaller than that are ser=
ved=20
all
> >at once.
> >-Casey
>=20
> But isn't it un-pickled into memory?

The file is divided into 64K chunks, each of which is pickled. Each chunk=
 is=20
unpickled separately and then discarded.
=20
> I did some work on this last year (for 2.4 or something) and in my test=
s
> Zope hang quite effectively when using regular File Objects.
> But streaming from a file on the file system did work every time.

If that's still true, then I would regard it as a bug.
=20
> I tried this on a 200MB video clip and the client was Microsoft MediaPl=
ayer.
>=20
> Have anything change in resent Zope releases?

It has been this way for a long time.

-Casey