[Twisted-web] bandwidth throttling a web2 server

Cameron Dale camrdale at gmail.com
Wed Feb 20 00:50:13 EST 2008


Hi,

I'm attempting to limit the bandwidth of a Twisted Web2 server.

I've tried using the twisted htb (token bucket) to limit it, which
didn't work at all (limits it to 0, then no more packets).

Now I'm trying to use the ThrottlingFactory, which I don't think works
for web (one), but I think might work for web2 since it is streaming.
So far I have had some success (it does throttle correctly sometimes),
but I do get the occasional errors from the ThrottlingFactory:

'NoneType' object has no attribute 'resumeProducing' in unthrottleWrites
'NoneType' object has no attribute 'pauseProducing' in throttleWrites
Tried to cancel an already-called event in unregisterProtocol

After the last one, my server was broken and had to be restarted,
though the first 2 errors seemed to have very little effect. Is it not
possible to use the ThrottlingFactory with the web2 server?

Maybe I've missed something obvious, but is there a better way to
limit the bandwidth of a web2 server?

Thanks,
Cameron



More information about the Twisted-web mailing list