[Twisted-Python] Throttling a web2 server

Jean-Paul Calderone exarkun at divmod.com
Tue Feb 26 16:17:03 EST 2008

On Tue, 26 Feb 2008 12:12:22 -0800, Cameron Dale <camrdale at gmail.com> wrote:
>I'm relatively new to Twisted, and I was wondering if anyone has had
>success with the ThrottlingFactory, or any other methods for
>throttling push producers.
>I'm attempting to throttle the bandwidth of the web2 server using the
>twisted.protocols.policies.ThrottlingFactory. I know this isn't
>possible with web1 (see Ticket #601), but it should be possible with
>web2 since web2 uses a streaming (push) producer.
>The trouble I'm having is that the ThrottlingFactory doesn't throttle
>the server at all. I've traced the output, and it seems to be due to
>the twisted.internet.tcp.Server also calling the pauseProducing() and
>resumeProducing() methods of the producer.
>The way the ThrottlingFactory works, is that it schedules periodic
>checks of the number of bytes written using reactor.callLater. If too
>many bytes have been written, then the producer is paused. However,
>these periodic checks always occur when the producer is already paused
>by the twisted.internet.tcp.Server, and so have no effect. Later the
>producer is resumed by the twisted.internet.tcp.Server, and so the
>throttling is non-existent.

Yes.  It would be good if ThrottlingFactory were fixed.  Would you like
to fix it? :)


More information about the Twisted-Python mailing list