Comment 1 for bug 720707

Revision history for this message
Facundo Batista (facundo) wrote : Re: it does not throttles inside the second, but sends a bunch of data and waits then some seconds to be below the limit

this is an effect of the following (examples for "write", the same applies for "read")... in the client.py, ThrottlingStorageClient has...

    def write(self, data):
        """Transport API to capture bytes written."""
        if self.factory.client is self:
            self.factory.registerWritten(len(data))
        StorageClient.write(self, data)

...that writes whatever data it got, and just tells the throttler the amount of data written. So, if the limit is X bytes per second, and twisted wants to write 10*X, it just writes that (probably saturating the tcp link), and then the throttler waits 9 seconds more to be below the limit.

The way to fix this is not write the whole amount at once, but mix that with the throttling scheme.