On 17/08/16 23:43, Steve Morin wrote:
Twisted Community

Problem: How do you determine the buffer size of a transport, to know
how much data is waiting to be transmitted from using transport.write?

You haven't received many responses, so I'll add a short note here:

The ideal way to do this IMO is to have the receiver send acknowledgements with a sequence number to the sender once a message has been received *and processed*. Keep track of these at the sender and adjust the sending rate accordingly.

Another complementary approach is for the client to keep track of the length (in space or in time/age) of it's local received-but-not-processed queue and report this. Keeping track of the queue in terms of delay is close to the CoDel approach for AQM.

Depending on the network portion of the implementation, the mere fact of a message having been received and TCP-ack'd doesn't tell you the client is keeping up - it might be receiving and buffering into RAM and getting more and more backlogged.

If you can't alter the protocol to include protocol-level ack messages then obviously you have to go the less satisfactory route and estimate it from the lower-layer transport. As JP has noted, you can get this from the kernel.

Flow control is hard ;o)

_______________________________________________
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python

Reply via email to