[Twisted-Python] When do calls to transport.write() block ?
Bob Ippolito
bob at redivi.com
Tue May 11 13:02:38 EDT 2004
On May 11, 2004, at 11:49 AM, Stefan Behnel wrote:
> Thank you for your quick answer!
>
> Itamar Shtull-Trauring wrote:
>>> If a server starts sending as fast as it can, what will happen to the
>>> output queue? Will Twisted just eat up all memory with buffers? Will
>>> it start blocking? Will it open up a thread? What will it do?
>> It will eat up all your memory. You should, therefore, not do that.
>> Instead, use producers and consumers (this is e.g. how the web server
>> sends large files):
>> http://itamarst.org/writings/etech04/twisted_internet-101.html
>
> That's about the idea I had about it, but I couldn't quite grasp it.
>
> I'm curious though: wouldn't it be much more pythonic to allow users
> to register a generator with the transport? A generator usually does
> exactly what is expected from a pull-producer.
>
> Do you/does anyone know if that's foreseen somewhere in Twisted,
> either now or in a later version?
Generators/iterators aren't prevalent in Twisted because until
relatively recently it didn't depend on Python 2.2 or later.
-bob
More information about the Twisted-Python
mailing list