diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/ThrottleRates.cs | 12 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs | 51 | ||||
-rw-r--r-- | bin/OpenSimDefaults.ini | 7 |
4 files changed, 53 insertions, 19 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs index 8f14806..de91856 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs | |||
@@ -229,7 +229,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
229 | m_throttleClient | 229 | m_throttleClient |
230 | = new AdaptiveTokenBucket( | 230 | = new AdaptiveTokenBucket( |
231 | string.Format("adaptive throttle for {0} in {1}", AgentID, server.Scene.Name), | 231 | string.Format("adaptive throttle for {0} in {1}", AgentID, server.Scene.Name), |
232 | parentThrottle, 0, rates.Total, rates.AdaptiveThrottlesEnabled); | 232 | parentThrottle, 0, rates.Total, rates.MinimumAdaptiveThrottleRate, rates.AdaptiveThrottlesEnabled); |
233 | 233 | ||
234 | // Create an array of token buckets for this clients different throttle categories | 234 | // Create an array of token buckets for this clients different throttle categories |
235 | m_throttleCategories = new TokenBucket[THROTTLE_CATEGORY_COUNT]; | 235 | m_throttleCategories = new TokenBucket[THROTTLE_CATEGORY_COUNT]; |
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/ThrottleRates.cs b/OpenSim/Region/ClientStack/Linden/UDP/ThrottleRates.cs index dd15cc7..7a2756b 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/ThrottleRates.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/ThrottleRates.cs | |||
@@ -58,7 +58,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
58 | 58 | ||
59 | /// <summary>Flag used to enable adaptive throttles</summary> | 59 | /// <summary>Flag used to enable adaptive throttles</summary> |
60 | public bool AdaptiveThrottlesEnabled; | 60 | public bool AdaptiveThrottlesEnabled; |
61 | 61 | ||
62 | /// <summary> | ||
63 | /// Set the minimum rate that the adaptive throttles can set. The viewer | ||
64 | /// can still throttle lower than this, but the adaptive throttles will | ||
65 | /// never decrease rates below this no matter how many packets are dropped | ||
66 | /// </summary> | ||
67 | public Int64 MinimumAdaptiveThrottleRate; | ||
68 | |||
62 | /// <summary>Amount of the texture throttle to steal for the task throttle</summary> | 69 | /// <summary>Amount of the texture throttle to steal for the task throttle</summary> |
63 | public double CannibalizeTextureRate; | 70 | public double CannibalizeTextureRate; |
64 | 71 | ||
@@ -84,7 +91,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
84 | Total = throttleConfig.GetInt("client_throttle_max_bps", 0); | 91 | Total = throttleConfig.GetInt("client_throttle_max_bps", 0); |
85 | 92 | ||
86 | AdaptiveThrottlesEnabled = throttleConfig.GetBoolean("enable_adaptive_throttles", false); | 93 | AdaptiveThrottlesEnabled = throttleConfig.GetBoolean("enable_adaptive_throttles", false); |
87 | 94 | MinimumAdaptiveThrottleRate = throttleConfig.GetInt("adaptive_throttle_min_bps", 32000); | |
95 | |||
88 | CannibalizeTextureRate = (double)throttleConfig.GetFloat("CannibalizeTextureRate", 0.0f); | 96 | CannibalizeTextureRate = (double)throttleConfig.GetFloat("CannibalizeTextureRate", 0.0f); |
89 | CannibalizeTextureRate = Util.Clamp<double>(CannibalizeTextureRate,0.0, 0.9); | 97 | CannibalizeTextureRate = Util.Clamp<double>(CannibalizeTextureRate,0.0, 0.9); |
90 | } | 98 | } |
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 | |||
392 | } | 392 | } |
393 | 393 | ||
394 | /// <summary> | 394 | /// <summary> |
395 | /// The minimum rate for flow control. Minimum drip rate is one | 395 | /// The minimum rate for adaptive flow control. |
396 | /// packet per second. Open the throttle to 15 packets per second | ||
397 | /// or about 160kbps. | ||
398 | /// </summary> | 396 | /// </summary> |
399 | protected const Int64 m_minimumFlow = m_minimumDripRate * 15; | 397 | protected Int64 m_minimumFlow = 32000; |
398 | public Int64 MinimumFlow | ||
399 | { | ||
400 | get { return m_minimumFlow; } | ||
401 | set | ||
402 | { | ||
403 | m_minimumFlow = value; | ||
404 | TargetDripRate = Math.Max(m_minimumFlow, TargetDripRate); | ||
405 | AdjustedDripRate = Math.Max(m_minimumFlow, AdjustedDripRate); | ||
406 | } | ||
407 | } | ||
400 | 408 | ||
401 | public AdaptiveTokenBucket(string identifier, TokenBucket parent, Int64 requestedDripRate, Int64 maxDripRate, bool enabled) | 409 | /// <summary> |
410 | /// Constructor for the AdaptiveTokenBucket class | ||
411 | /// <param name="identifier">Unique identifier for the client</param> | ||
412 | /// <param name="parent">Parent bucket in the hierarchy</param> | ||
413 | /// <param name="requestedDripRate"></param> | ||
414 | /// <param name="maxDripRate">The ceiling rate for adaptation</param> | ||
415 | /// <param name="minDripRate">The floor rate for adaptation</param> | ||
416 | /// </summary> | ||
417 | public AdaptiveTokenBucket(string identifier, TokenBucket parent, Int64 requestedDripRate, Int64 maxDripRate, Int64 minDripRate, bool enabled) | ||
402 | : base(identifier, parent, requestedDripRate, maxDripRate) | 418 | : base(identifier, parent, requestedDripRate, maxDripRate) |
403 | { | 419 | { |
404 | AdaptiveEnabled = enabled; | 420 | AdaptiveEnabled = enabled; |
@@ -406,34 +422,37 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
406 | if (AdaptiveEnabled) | 422 | if (AdaptiveEnabled) |
407 | { | 423 | { |
408 | // m_log.DebugFormat("[TOKENBUCKET]: Adaptive throttle enabled"); | 424 | // m_log.DebugFormat("[TOKENBUCKET]: Adaptive throttle enabled"); |
425 | m_minimumFlow = minDripRate; | ||
409 | TargetDripRate = m_minimumFlow; | 426 | TargetDripRate = m_minimumFlow; |
410 | AdjustedDripRate = m_minimumFlow; | 427 | AdjustedDripRate = m_minimumFlow; |
411 | } | 428 | } |
412 | } | 429 | } |
413 | 430 | ||
414 | // <summary> | 431 | /// <summary> |
415 | // Reliable packets sent to the client for which we never received an ack adjust the drip rate down. | 432 | /// Reliable packets sent to the client for which we never received an ack adjust the drip rate down. |
416 | // </summary> | 433 | /// <param name="packets">Number of packets that expired without successful delivery</param> |
417 | public void ExpirePackets(Int32 count) | 434 | /// </summary> |
435 | public void ExpirePackets(Int32 packets) | ||
418 | { | 436 | { |
419 | if (AdaptiveEnabled) | 437 | if (AdaptiveEnabled) |
420 | { | 438 | { |
421 | if (DebugLevel > 0) | 439 | if (DebugLevel > 0) |
422 | m_log.WarnFormat( | 440 | m_log.WarnFormat( |
423 | "[ADAPTIVEBUCKET] drop {0} by {1} expired packets for {2}", | 441 | "[ADAPTIVEBUCKET] drop {0} by {1} expired packets for {2}", |
424 | AdjustedDripRate, count, Identifier); | 442 | AdjustedDripRate, packets, Identifier); |
425 | 443 | ||
426 | AdjustedDripRate = (Int64) (AdjustedDripRate / Math.Pow(2,count)); | 444 | AdjustedDripRate = (Int64) (AdjustedDripRate / Math.Pow(2,packets)); |
427 | } | 445 | } |
428 | } | 446 | } |
429 | 447 | ||
430 | // <summary> | 448 | /// <summary> |
431 | // Reliable packets acked by the client adjust the drip rate up. | 449 | /// Reliable packets acked by the client adjust the drip rate up. |
432 | // </summary> | 450 | /// <param name="bytes">Number of bytes acknowledged</param> |
433 | public void AcknowledgePackets(Int32 count) | 451 | /// </summary> |
452 | public void AcknowledgePackets(Int32 bytes) | ||
434 | { | 453 | { |
435 | if (AdaptiveEnabled) | 454 | if (AdaptiveEnabled) |
436 | AdjustedDripRate = AdjustedDripRate + count; | 455 | AdjustedDripRate = AdjustedDripRate + bytes; |
437 | } | 456 | } |
438 | } | 457 | } |
439 | } \ No newline at end of file | 458 | } \ No newline at end of file |
diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini index 3e9514e..212baab 100644 --- a/bin/OpenSimDefaults.ini +++ b/bin/OpenSimDefaults.ini | |||
@@ -544,6 +544,13 @@ | |||
544 | ; | 544 | ; |
545 | ;client_throttle_max_bps = 187500 | 545 | ;client_throttle_max_bps = 187500 |
546 | 546 | ||
547 | ; Minimum bytes per second to send to any single client as a result of | ||
548 | ; adaptive throttling. Viewer preferences set to a lower number will | ||
549 | ; override the settin. The example given here ensures that adaptive | ||
550 | ; throttling will never decrease per client bandwidth below 256 kbps. | ||
551 | ; | ||
552 | ;adaptive_throttle_min_bps = 32000 | ||
553 | |||
547 | ; Adaptive throttling attempts to limit network overload when multiple | 554 | ; Adaptive throttling attempts to limit network overload when multiple |
548 | ; clients login by starting each connection more slowly. Disabled by | 555 | ; clients login by starting each connection more slowly. Disabled by |
549 | ; default | 556 | ; default |