From 041a09ecb9eed43936a88312c11e9440bd3b6337 Mon Sep 17 00:00:00 2001
From: Mic Bowman
Date: Mon, 29 Dec 2014 18:46:33 -0800
Subject: Enable runtime configuration of the minimum rate for adaptive
throttles. Setting adaptive_throttle_min_bps will change the minimum rate
that the adapative throttles will drop to in case of network packet loss. The
current rate default rate is 256kbps. The viewer can throttle rates under
that amount, but the dynamic adaptation will not.
---
.../Region/ClientStack/Linden/UDP/TokenBucket.cs | 51 +++++++++++++++-------
1 file changed, 35 insertions(+), 16 deletions(-)
(limited to 'OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs')
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs b/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs
index d215595..c0cdff6 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs
@@ -392,13 +392,29 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
///
- /// The minimum rate for flow control. Minimum drip rate is one
- /// packet per second. Open the throttle to 15 packets per second
- /// or about 160kbps.
+ /// The minimum rate for adaptive flow control.
///
- protected const Int64 m_minimumFlow = m_minimumDripRate * 15;
+ 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);
+ }
+ }
- public AdaptiveTokenBucket(string identifier, TokenBucket parent, Int64 requestedDripRate, Int64 maxDripRate, bool enabled)
+ ///
+ /// Constructor for the AdaptiveTokenBucket class
+ /// Unique identifier for the client
+ /// Parent bucket in the hierarchy
+ ///
+ /// The ceiling rate for adaptation
+ /// The floor rate for adaptation
+ ///
+ public AdaptiveTokenBucket(string identifier, TokenBucket parent, Int64 requestedDripRate, Int64 maxDripRate, Int64 minDripRate, bool enabled)
: base(identifier, parent, requestedDripRate, maxDripRate)
{
AdaptiveEnabled = enabled;
@@ -406,34 +422,37 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (AdaptiveEnabled)
{
// m_log.DebugFormat("[TOKENBUCKET]: Adaptive throttle enabled");
+ m_minimumFlow = minDripRate;
TargetDripRate = m_minimumFlow;
AdjustedDripRate = m_minimumFlow;
}
}
- //
- // Reliable packets sent to the client for which we never received an ack adjust the drip rate down.
- //
- public void ExpirePackets(Int32 count)
+ ///
+ /// Reliable packets sent to the client for which we never received an ack adjust the drip rate down.
+ /// Number of packets that expired without successful delivery
+ ///
+ public void ExpirePackets(Int32 packets)
{
if (AdaptiveEnabled)
{
if (DebugLevel > 0)
m_log.WarnFormat(
"[ADAPTIVEBUCKET] drop {0} by {1} expired packets for {2}",
- AdjustedDripRate, count, Identifier);
+ AdjustedDripRate, packets, Identifier);
- AdjustedDripRate = (Int64) (AdjustedDripRate / Math.Pow(2,count));
+ AdjustedDripRate = (Int64) (AdjustedDripRate / Math.Pow(2,packets));
}
}
- //
- // Reliable packets acked by the client adjust the drip rate up.
- //
- public void AcknowledgePackets(Int32 count)
+ ///
+ /// Reliable packets acked by the client adjust the drip rate up.
+ /// Number of bytes acknowledged
+ ///
+ public void AcknowledgePackets(Int32 bytes)
{
if (AdaptiveEnabled)
- AdjustedDripRate = AdjustedDripRate + count;
+ AdjustedDripRate = AdjustedDripRate + bytes;
}
}
}
\ No newline at end of file
--
cgit v1.1
From bda8f2a2c1d702adc9e61869195a4dbcd3c6751f Mon Sep 17 00:00:00 2001
From: Mic Bowman
Date: Mon, 29 Dec 2014 23:19:10 -0800
Subject: Change the effect of successfully acknowledged packets to bump the
adaptive throttle by a full MTU. This is consistent with some implementations
of congestion control algorithms and certainly has the effect of opening the
throttle window more quickly after errors. This is especially important after
initial scene load when the number and size of packets is small.
---
OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
(limited to 'OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs')
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs b/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs
index c0cdff6..e67c0f5 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs
@@ -61,7 +61,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
///
///
- protected const Int32 m_minimumDripRate = 1400;
+ protected const Int32 m_minimumDripRate = LLUDPServer.MTU;
/// Time of the last drip, in system ticks
protected Int32 m_lastDrip;
@@ -447,12 +447,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
///
/// Reliable packets acked by the client adjust the drip rate up.
- /// Number of bytes acknowledged
+ /// Number of packets successfully acknowledged
///
- public void AcknowledgePackets(Int32 bytes)
+ public void AcknowledgePackets(Int32 packets)
{
if (AdaptiveEnabled)
- AdjustedDripRate = AdjustedDripRate + bytes;
+ AdjustedDripRate = AdjustedDripRate + packets * LLUDPServer.MTU;
}
}
}
\ No newline at end of file
--
cgit v1.1
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(-)
(limited to 'OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs')
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