[Zope3-dev] Asyncore (and Twisted)
Leonardo Rochael Almeida
leo@hiper.com.br
01 Nov 2002 17:02:55 -0200
On Fri, 2002-11-01 at 12:40, Shane Hathaway wrote:
> Chris Withers wrote:
> > Shane Hathaway wrote:
> >
> >>
> >> Well, I don't think networking from threads is the real goal. What's
> >> important is that Zope's ZODB connections are scarce and precious, so
> >> time spent in application code must be minimized. To help achieve
> >> this, Zope threads must never block for I/O except in rare cases.
> >> Therefore all input and output must be fully buffered.
> >
> >
> > How does this interact with the (admittedly edge) case of pages where
> > you want to write the output bit by bit?
> > (I'm thinking things like the dots that ZUnit used to write out...)
Wow, someone actually remember those :-) (Hi Albertaas, enjoying being
the new mantainer? :-)
> In cases like that, without the optimization, the thread must block
> waiting for the main loop, which in turn waits for I/O. With the
> optimization, the thread can avoid the main loop and do I/O itself. But
> like you said, this is an edge case.
I, for one, have written a lot of streamming pages:
* ZUnit dots :-)
* Newsletter sending systems
* Full scale recataloging of objects (in situations where ZCatalog's own
"Find Objects" was so slow as to cause time-outs), and other
ZODB-rovering activities.
Basically any place there was a possibility of an activity taking too
long and we couldn't afford the browser to time out (clients wheren't
too keen on browsers timing out for some reason :-)
Admitedly, most of the uses of a streamming page are stressing the
limits of Zope apropriatedness (sp?) (i.e. few would argue Zope as the
best infrastructure for a Web chat app), but it's one of those cases of
"when you need it you need it badly".
So I humbly ask for some possibility of streamming pages, even if in a
suboptimal way.
Cheers, Leo
--
Ideas don't stay in some minds very long because they don't like
solitary confinement.