[Twisted-Python] When do calls to transport.write() block ?

Stefan Behnel behnel_ml at gkec.informatik.tu-darmstadt.de
Tue May 11 11:49:11 EDT 2004

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?


More information about the Twisted-Python mailing list