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.
This commit is contained in:
Mic Bowman
2014-12-29 18:46:33 -08:00
parent e71549a2cb
commit 041a09ecb9
4 changed files with 53 additions and 19 deletions

View File

@@ -392,13 +392,29 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
/// <summary>
/// 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.
/// </summary>
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)
/// <summary>
/// Constructor for the AdaptiveTokenBucket class
/// <param name="identifier">Unique identifier for the client</param>
/// <param name="parent">Parent bucket in the hierarchy</param>
/// <param name="requestedDripRate"></param>
/// <param name="maxDripRate">The ceiling rate for adaptation</param>
/// <param name="minDripRate">The floor rate for adaptation</param>
/// </summary>
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;
}
}
// <summary>
// Reliable packets sent to the client for which we never received an ack adjust the drip rate down.
// </summary>
public void ExpirePackets(Int32 count)
/// <summary>
/// Reliable packets sent to the client for which we never received an ack adjust the drip rate down.
/// <param name="packets">Number of packets that expired without successful delivery</param>
/// </summary>
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));
}
}
// <summary>
// Reliable packets acked by the client adjust the drip rate up.
// </summary>
public void AcknowledgePackets(Int32 count)
/// <summary>
/// Reliable packets acked by the client adjust the drip rate up.
/// <param name="bytes">Number of bytes acknowledged</param>
/// </summary>
public void AcknowledgePackets(Int32 bytes)
{
if (AdaptiveEnabled)
AdjustedDripRate = AdjustedDripRate + count;
AdjustedDripRate = AdjustedDripRate + bytes;
}
}
}