From c06100c31f9c0a2785c131a6100ecce823ed0f38 Mon Sep 17 00:00:00 2001 From: Mic Bowman Date: Tue, 30 Dec 2014 10:39:14 -0800 Subject: Another technique inspired by some of the newer flow control algorithms... rather than drop exponentially to 0 (and then adjust up for the minimum flow), drop on the delta between current rate and the minimum rate. This should smooth the fallback to minimum. --- .../Region/ClientStack/Linden/UDP/TokenBucket.cs | 28 +++++++++++++--------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs b/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs index e67c0f5..38ae760 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs @@ -395,16 +395,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// The minimum rate for adaptive flow control. /// protected Int64 m_minimumFlow = 32000; - public Int64 MinimumFlow - { - get { return m_minimumFlow; } - set - { - m_minimumFlow = value; - TargetDripRate = Math.Max(m_minimumFlow, TargetDripRate); - AdjustedDripRate = Math.Max(m_minimumFlow, AdjustedDripRate); - } - } /// /// Constructor for the AdaptiveTokenBucket class @@ -441,7 +431,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP "[ADAPTIVEBUCKET] drop {0} by {1} expired packets for {2}", AdjustedDripRate, packets, Identifier); - AdjustedDripRate = (Int64) (AdjustedDripRate / Math.Pow(2,packets)); + // AdjustedDripRate = (Int64) (AdjustedDripRate / Math.Pow(2,packets)); + + // Compute the fallback solely on the rate allocated beyond the minimum, this + // should smooth out the fallback to the minimum rate + AdjustedDripRate = m_minimumFlow + (Int64) ((AdjustedDripRate - m_minimumFlow) / Math.Pow(2, packets)); } } @@ -454,5 +448,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (AdaptiveEnabled) AdjustedDripRate = AdjustedDripRate + packets * LLUDPServer.MTU; } + + /// + /// Adjust the minimum flow level for the adaptive throttle, this will drop adjusted + /// throttles back to the minimum levels + /// minDripRate--the new minimum flow + /// + public void ResetMinimumAdaptiveFlow(Int64 minDripRate) + { + m_minimumFlow = minDripRate; + TargetDripRate = m_minimumFlow; + AdjustedDripRate = m_minimumFlow; + } } } \ No newline at end of file -- cgit v1.1