ThrottlerTransportAdapter provides slower speed when lending tokens
ThrottlerTransportAdapter uses a token bucket to implement throttling. One tradeoff when setting up a token bucket is that the larger capacity it has, the less precise (more bursty) it becomes -- although it always maintains the average rate properly. To overcome this problem, the current implementation allows smaller capacities and "lends" tokens if the capacity is too low. The "lent" tokens will be "repayed".
The problem is that lending does not work accurately, and gives lower rates than it should, causing timeouts in some tests (ReliableProxySpec revealed this). The current workaround is to have a higher token bucket capacity.
The problem is that lending does not work accurately, and gives lower rates than it should, causing timeouts in some tests (ReliableProxySpec revealed this). The current workaround is to have a higher token bucket capacity.
Leave a comment
Most probably relates to PR1209
See comment in code:
See comment in code:
outboundThrottleMode.get match {
case Blackhole ⇒ true
case bucket @ _ ⇒
val success = tryConsume(outboundThrottleMode.get())
if (success) wrappedHandle.write(payload) else false
// FIXME: this depletes the token bucket even when no write happened!!
}