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.mb-throttle-test
parent
e71549a2cb
commit
041a09ecb9
|
@ -229,7 +229,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
m_throttleClient
|
m_throttleClient
|
||||||
= new AdaptiveTokenBucket(
|
= new AdaptiveTokenBucket(
|
||||||
string.Format("adaptive throttle for {0} in {1}", AgentID, server.Scene.Name),
|
string.Format("adaptive throttle for {0} in {1}", AgentID, server.Scene.Name),
|
||||||
parentThrottle, 0, rates.Total, rates.AdaptiveThrottlesEnabled);
|
parentThrottle, 0, rates.Total, rates.MinimumAdaptiveThrottleRate, rates.AdaptiveThrottlesEnabled);
|
||||||
|
|
||||||
// Create an array of token buckets for this clients different throttle categories
|
// Create an array of token buckets for this clients different throttle categories
|
||||||
m_throttleCategories = new TokenBucket[THROTTLE_CATEGORY_COUNT];
|
m_throttleCategories = new TokenBucket[THROTTLE_CATEGORY_COUNT];
|
||||||
|
|
|
@ -58,7 +58,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
|
|
||||||
/// <summary>Flag used to enable adaptive throttles</summary>
|
/// <summary>Flag used to enable adaptive throttles</summary>
|
||||||
public bool AdaptiveThrottlesEnabled;
|
public bool AdaptiveThrottlesEnabled;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Set the minimum rate that the adaptive throttles can set. The viewer
|
||||||
|
/// can still throttle lower than this, but the adaptive throttles will
|
||||||
|
/// never decrease rates below this no matter how many packets are dropped
|
||||||
|
/// </summary>
|
||||||
|
public Int64 MinimumAdaptiveThrottleRate;
|
||||||
|
|
||||||
/// <summary>Amount of the texture throttle to steal for the task throttle</summary>
|
/// <summary>Amount of the texture throttle to steal for the task throttle</summary>
|
||||||
public double CannibalizeTextureRate;
|
public double CannibalizeTextureRate;
|
||||||
|
|
||||||
|
@ -84,7 +91,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
Total = throttleConfig.GetInt("client_throttle_max_bps", 0);
|
Total = throttleConfig.GetInt("client_throttle_max_bps", 0);
|
||||||
|
|
||||||
AdaptiveThrottlesEnabled = throttleConfig.GetBoolean("enable_adaptive_throttles", false);
|
AdaptiveThrottlesEnabled = throttleConfig.GetBoolean("enable_adaptive_throttles", false);
|
||||||
|
MinimumAdaptiveThrottleRate = throttleConfig.GetInt("adaptive_throttle_min_bps", 32000);
|
||||||
|
|
||||||
CannibalizeTextureRate = (double)throttleConfig.GetFloat("CannibalizeTextureRate", 0.0f);
|
CannibalizeTextureRate = (double)throttleConfig.GetFloat("CannibalizeTextureRate", 0.0f);
|
||||||
CannibalizeTextureRate = Util.Clamp<double>(CannibalizeTextureRate,0.0, 0.9);
|
CannibalizeTextureRate = Util.Clamp<double>(CannibalizeTextureRate,0.0, 0.9);
|
||||||
}
|
}
|
||||||
|
|
|
@ -392,13 +392,29 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The minimum rate for flow control. Minimum drip rate is one
|
/// The minimum rate for adaptive flow control.
|
||||||
/// packet per second. Open the throttle to 15 packets per second
|
|
||||||
/// or about 160kbps.
|
|
||||||
/// </summary>
|
/// </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)
|
: base(identifier, parent, requestedDripRate, maxDripRate)
|
||||||
{
|
{
|
||||||
AdaptiveEnabled = enabled;
|
AdaptiveEnabled = enabled;
|
||||||
|
@ -406,34 +422,37 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
if (AdaptiveEnabled)
|
if (AdaptiveEnabled)
|
||||||
{
|
{
|
||||||
// m_log.DebugFormat("[TOKENBUCKET]: Adaptive throttle enabled");
|
// m_log.DebugFormat("[TOKENBUCKET]: Adaptive throttle enabled");
|
||||||
|
m_minimumFlow = minDripRate;
|
||||||
TargetDripRate = m_minimumFlow;
|
TargetDripRate = m_minimumFlow;
|
||||||
AdjustedDripRate = m_minimumFlow;
|
AdjustedDripRate = m_minimumFlow;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// <summary>
|
/// <summary>
|
||||||
// Reliable packets sent to the client for which we never received an ack adjust the drip rate down.
|
/// Reliable packets sent to the client for which we never received an ack adjust the drip rate down.
|
||||||
// </summary>
|
/// <param name="packets">Number of packets that expired without successful delivery</param>
|
||||||
public void ExpirePackets(Int32 count)
|
/// </summary>
|
||||||
|
public void ExpirePackets(Int32 packets)
|
||||||
{
|
{
|
||||||
if (AdaptiveEnabled)
|
if (AdaptiveEnabled)
|
||||||
{
|
{
|
||||||
if (DebugLevel > 0)
|
if (DebugLevel > 0)
|
||||||
m_log.WarnFormat(
|
m_log.WarnFormat(
|
||||||
"[ADAPTIVEBUCKET] drop {0} by {1} expired packets for {2}",
|
"[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>
|
/// <summary>
|
||||||
// Reliable packets acked by the client adjust the drip rate up.
|
/// Reliable packets acked by the client adjust the drip rate up.
|
||||||
// </summary>
|
/// <param name="bytes">Number of bytes acknowledged</param>
|
||||||
public void AcknowledgePackets(Int32 count)
|
/// </summary>
|
||||||
|
public void AcknowledgePackets(Int32 bytes)
|
||||||
{
|
{
|
||||||
if (AdaptiveEnabled)
|
if (AdaptiveEnabled)
|
||||||
AdjustedDripRate = AdjustedDripRate + count;
|
AdjustedDripRate = AdjustedDripRate + bytes;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -544,6 +544,13 @@
|
||||||
;
|
;
|
||||||
;client_throttle_max_bps = 187500
|
;client_throttle_max_bps = 187500
|
||||||
|
|
||||||
|
; Minimum bytes per second to send to any single client as a result of
|
||||||
|
; adaptive throttling. Viewer preferences set to a lower number will
|
||||||
|
; override the settin. The example given here ensures that adaptive
|
||||||
|
; throttling will never decrease per client bandwidth below 256 kbps.
|
||||||
|
;
|
||||||
|
;adaptive_throttle_min_bps = 32000
|
||||||
|
|
||||||
; Adaptive throttling attempts to limit network overload when multiple
|
; Adaptive throttling attempts to limit network overload when multiple
|
||||||
; clients login by starting each connection more slowly. Disabled by
|
; clients login by starting each connection more slowly. Disabled by
|
||||||
; default
|
; default
|
||||||
|
|
Loading…
Reference in New Issue