From e71549a2cb01609f781667490f68dc2876c5c024 Mon Sep 17 00:00:00 2001 From: Mic Bowman Date: Mon, 29 Dec 2014 12:02:36 -0800 Subject: [PATCH 1/7] Add debugging code for simulating packet loss in outgoing UDP packets. The algorithm for dropping packets is a modified two state algorithm for creating bursts of dropped packets. As configured there is about a 1.5% drop rate. Invocation of the packet loss code is commented out by default. --- .../ClientStack/Linden/UDP/OpenSimUDPBase.cs | 66 +++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs b/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs index 94300f846b..9bee3ad20d 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs @@ -107,6 +107,62 @@ namespace OpenMetaverse /// public float AverageReceiveTicksForLastSamplePeriod { get; private set; } + #region PacketDropDebugging + /// + /// For debugging purposes only... random number generator for dropping + /// outbound packets. + /// + private Random m_dropRandomGenerator; + + /// + /// For debugging purposes only... parameters for a simplified + /// model of packet loss with bursts, overall drop rate should + /// be roughly 1 - m_dropLengthProbability / (m_dropProbabiliy + m_dropLengthProbability) + /// which is about 1% for parameters 0.0015 and 0.15 + /// + private double m_dropProbability = 0.0030; + private double m_dropLengthProbability = 0.15; + private bool m_dropState = false; + + /// + /// For debugging purposes only... parameters to control the time + /// duration over which packet loss bursts can occur, if no packets + /// have been sent for m_dropResetTicks milliseconds, then reset the + /// state of the packet dropper to its default. + /// + private int m_dropLastTick = 0; + private int m_dropResetTicks = 500; + + /// + /// Debugging code used to simulate dropped packets with bursts + /// + private bool DropOutgoingPacket() + { + double rnum = m_dropRandomGenerator.NextDouble(); + + // if the connection has been idle for awhile (more than m_dropResetTicks) then + // reset the state to the default state, don't continue a burst + int curtick = Util.EnvironmentTickCount(); + if (Util.EnvironmentTickCountSubtract(curtick, m_dropLastTick) > m_dropResetTicks) + m_dropState = false; + + m_dropLastTick = curtick; + + // if we are dropping packets, then the probability of dropping + // this packet is the probability that we stay in the burst + if (m_dropState) + { + m_dropState = (rnum < (1.0 - m_dropLengthProbability)) ? true : false; + } + else + { + m_dropState = (rnum < m_dropProbability) ? true : false; + } + + return m_dropState; + } + #endregion PacketDropDebugging + /// /// Default constructor /// @@ -117,6 +173,10 @@ namespace OpenMetaverse { m_localBindAddress = bindAddress; m_udpPort = port; + + // for debugging purposes only, initializes the random number generator + // used for simulating packet loss + // m_dropRandomGenerator = new Random(); } /// @@ -395,6 +455,12 @@ namespace OpenMetaverse { // if (IsRunningOutbound) // { + + // This is strictly for debugging purposes to simulate dropped + // packets when testing throttles & retransmission code + // if (DropOutgoingPacket()) + // return; + try { m_udpSocket.BeginSendTo( From 041a09ecb9eed43936a88312c11e9440bd3b6337 Mon Sep 17 00:00:00 2001 From: Mic Bowman Date: Mon, 29 Dec 2014 18:46:33 -0800 Subject: [PATCH 2/7] 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. --- .../ClientStack/Linden/UDP/LLUDPClient.cs | 2 +- .../ClientStack/Linden/UDP/ThrottleRates.cs | 12 ++++- .../ClientStack/Linden/UDP/TokenBucket.cs | 51 +++++++++++++------ 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 8f14806206..de9185651a 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 m_throttleClient = new AdaptiveTokenBucket( 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 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 dd15cc7d4f..7a2756bab1 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 /// Flag used to enable adaptive throttles public bool AdaptiveThrottlesEnabled; - + + /// + /// 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 + /// + public Int64 MinimumAdaptiveThrottleRate; + /// Amount of the texture throttle to steal for the task throttle public double CannibalizeTextureRate; @@ -84,7 +91,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP Total = throttleConfig.GetInt("client_throttle_max_bps", 0); AdaptiveThrottlesEnabled = throttleConfig.GetBoolean("enable_adaptive_throttles", false); - + MinimumAdaptiveThrottleRate = throttleConfig.GetInt("adaptive_throttle_min_bps", 32000); + CannibalizeTextureRate = (double)throttleConfig.GetFloat("CannibalizeTextureRate", 0.0f); CannibalizeTextureRate = Util.Clamp(CannibalizeTextureRate,0.0, 0.9); } diff --git a/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs b/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs index d215595c7b..c0cdff6d90 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 diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini index 3e9514ebbf..212baabc7f 100644 --- a/bin/OpenSimDefaults.ini +++ b/bin/OpenSimDefaults.ini @@ -544,6 +544,13 @@ ; ;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 ; clients login by starting each connection more slowly. Disabled by ; default From bda8f2a2c1d702adc9e61869195a4dbcd3c6751f Mon Sep 17 00:00:00 2001 From: Mic Bowman Date: Mon, 29 Dec 2014 23:19:10 -0800 Subject: [PATCH 3/7] 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. --- .../Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs | 4 ++-- OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs | 8 ++++---- .../ClientStack/Linden/UDP/UnackedPacketCollection.cs | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs b/OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs index 0560b9bc32..17e1af6156 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs @@ -141,7 +141,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests udpServer.Throttle.DebugLevel = 1; udpClient.ThrottleDebugLevel = 1; - + int resendBytes = 1000; int landBytes = 2000; int windBytes = 3000; @@ -208,7 +208,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests textureBytes * commitRatio, assetBytes * commitRatio, udpClient.FlowThrottle.AdjustedDripRate, totalBytes, 0); // Test an increase in target throttle - udpClient.FlowThrottle.AcknowledgePackets(35000); + udpClient.FlowThrottle.AcknowledgePackets(25); commitRatio = 0.2; AssertThrottles( diff --git a/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs b/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs index c0cdff6d90..e67c0f5bb8 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 diff --git a/OpenSim/Region/ClientStack/Linden/UDP/UnackedPacketCollection.cs b/OpenSim/Region/ClientStack/Linden/UDP/UnackedPacketCollection.cs index 9d6c09e612..adf019f104 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/UnackedPacketCollection.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/UnackedPacketCollection.cs @@ -192,7 +192,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // As with other network applications, assume that an acknowledged packet is an // indication that the network can handle a little more load, speed up the transmission - ackedPacket.Client.FlowThrottle.AcknowledgePackets(ackedPacket.Buffer.DataLength); + ackedPacket.Client.FlowThrottle.AcknowledgePackets(1); // Update stats Interlocked.Add(ref ackedPacket.Client.UnackedBytes, -ackedPacket.Buffer.DataLength); From 75df04f0b372625ed753b65bb84385fa258a58ea Mon Sep 17 00:00:00 2001 From: Mic Bowman Date: Tue, 30 Dec 2014 10:03:37 -0800 Subject: [PATCH 4/7] Fix the throttle tests. Remove the hardcoded constant multipliers and compute the expected values without depending on the token bucket code. --- .../Linden/UDP/Tests/ThrottleTests.cs | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs b/OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs index 17e1af6156..9241e372a6 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs @@ -173,6 +173,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests IniConfigSource ics = new IniConfigSource(); IConfig config = ics.AddConfig("ClientStack.LindenUDP"); config.Set("enable_adaptive_throttles", true); + config.Set("adaptive_throttle_min_bps", 32000); + TestLLUDPServer udpServer = ClientStackHelpers.AddUdpServer(scene, ics); ScenePresence sp @@ -197,28 +199,28 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests SetThrottles( udpClient, resendBytes, landBytes, windBytes, cloudBytes, taskBytes, textureBytes, assetBytes); - // Ratio of current adaptive drip rate to requested bytes - // XXX: Should hard code this as below so we don't rely on values given by tested code to construct - // expected values. - double commitRatio = (double)udpClient.FlowThrottle.AdjustedDripRate / udpClient.FlowThrottle.TargetDripRate; + // Ratio of current adaptive drip rate to requested bytes, minimum rate is 32000 + double commitRatio = 32000.0 / totalBytes; AssertThrottles( udpClient, LLUDPServer.MTU, landBytes * commitRatio, windBytes * commitRatio, cloudBytes * commitRatio, taskBytes * commitRatio, textureBytes * commitRatio, assetBytes * commitRatio, udpClient.FlowThrottle.AdjustedDripRate, totalBytes, 0); - // Test an increase in target throttle - udpClient.FlowThrottle.AcknowledgePackets(25); - commitRatio = 0.2; + // Test an increase in target throttle, ack of 20 packets adds 20 * LLUDPServer.MTU bytes + // to the throttle, recompute commitratio from those numbers + udpClient.FlowThrottle.AcknowledgePackets(20); + commitRatio = (32000.0 + 20.0 * LLUDPServer.MTU) / totalBytes; AssertThrottles( udpClient, resendBytes * commitRatio, landBytes * commitRatio, windBytes * commitRatio, cloudBytes * commitRatio, taskBytes * commitRatio, textureBytes * commitRatio, assetBytes * commitRatio, udpClient.FlowThrottle.AdjustedDripRate, totalBytes, 0); - // Test a decrease in target throttle + // Test a decrease in target throttle, adaptive throttle should cut the rate by 50% with a floor + // set by the minimum adaptive rate udpClient.FlowThrottle.ExpirePackets(1); - commitRatio = 0.1; + commitRatio = Math.Max((32000.0 + 20.0 * LLUDPServer.MTU)/Math.Pow(2,1), 32000.0) / totalBytes; AssertThrottles( udpClient, From c06100c31f9c0a2785c131a6100ecce823ed0f38 Mon Sep 17 00:00:00 2001 From: Mic Bowman Date: Tue, 30 Dec 2014 10:39:14 -0800 Subject: [PATCH 5/7] 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. --- .../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 e67c0f5bb8..38ae760567 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 From 58229a968b5659697a703e9234f216ff7dadfeac Mon Sep 17 00:00:00 2001 From: Mic Bowman Date: Tue, 30 Dec 2014 10:50:34 -0800 Subject: [PATCH 6/7] Turn on logging of old acks, this is for debugging only, stats version coming later --- .../Linden/UDP/UnackedPacketCollection.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/UnackedPacketCollection.cs b/OpenSim/Region/ClientStack/Linden/UDP/UnackedPacketCollection.cs index adf019f104..3599a162b3 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/UnackedPacketCollection.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/UnackedPacketCollection.cs @@ -31,6 +31,9 @@ using System.Net; using System.Threading; using OpenMetaverse; +using System.Reflection; +using log4net; + namespace OpenSim.Region.ClientStack.LindenUDP { /// @@ -60,6 +63,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + /// Holds the actual unacked packet data, sorted by sequence number private Dictionary m_packets = new Dictionary(); /// Holds packets that need to be added to the unacknowledged list @@ -207,9 +212,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP } else { - //m_log.WarnFormat("[UNACKED PACKET COLLECTION]: Could not find packet with sequence number {0} to ack", pendingAcknowledgement.SequenceNumber); + m_log.WarnFormat("[UNACKED PACKET COLLECTION]: found null packet for sequence number {0} to ack", + pendingAcknowledgement.SequenceNumber); } } + else + { + m_log.WarnFormat("[UNACKED PACKET COLLECTION]: Could not find packet with sequence number {0} to ack", + pendingAcknowledgement.SequenceNumber); + } } uint pendingRemove; From 5bb73793c73bfb40d90c99c0fd1f2f21425a2c0f Mon Sep 17 00:00:00 2001 From: Mic Bowman Date: Tue, 30 Dec 2014 14:43:42 -0800 Subject: [PATCH 7/7] Comment out the debugging statements added in the last commit. Keeping them in the code for later use rather than just reverting them. Fixed the throttle tests for the new algorithm used when packets are marked as expired. --- .../Linden/UDP/Tests/ThrottleTests.cs | 8 ++++---- .../Linden/UDP/UnackedPacketCollection.cs | 18 +++++++++--------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs b/OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs index 9241e372a6..3c82a7882f 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs @@ -186,8 +186,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests udpServer.Throttle.DebugLevel = 1; udpClient.ThrottleDebugLevel = 1; - // Total is 280000 - int resendBytes = 10000; + // Total is 275000 + int resendBytes = 5000; // this is set low to test the minimum throttle override int landBytes = 20000; int windBytes = 30000; int cloudBytes = 40000; @@ -214,13 +214,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests AssertThrottles( udpClient, - resendBytes * commitRatio, landBytes * commitRatio, windBytes * commitRatio, cloudBytes * commitRatio, taskBytes * commitRatio, + LLUDPServer.MTU, landBytes * commitRatio, windBytes * commitRatio, cloudBytes * commitRatio, taskBytes * commitRatio, textureBytes * commitRatio, assetBytes * commitRatio, udpClient.FlowThrottle.AdjustedDripRate, totalBytes, 0); // Test a decrease in target throttle, adaptive throttle should cut the rate by 50% with a floor // set by the minimum adaptive rate udpClient.FlowThrottle.ExpirePackets(1); - commitRatio = Math.Max((32000.0 + 20.0 * LLUDPServer.MTU)/Math.Pow(2,1), 32000.0) / totalBytes; + commitRatio = (32000.0 + (20.0 * LLUDPServer.MTU)/Math.Pow(2,1)) / totalBytes; AssertThrottles( udpClient, diff --git a/OpenSim/Region/ClientStack/Linden/UDP/UnackedPacketCollection.cs b/OpenSim/Region/ClientStack/Linden/UDP/UnackedPacketCollection.cs index 3599a162b3..b546a99603 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/UnackedPacketCollection.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/UnackedPacketCollection.cs @@ -31,8 +31,8 @@ using System.Net; using System.Threading; using OpenMetaverse; -using System.Reflection; -using log4net; +//using System.Reflection; +//using log4net; namespace OpenSim.Region.ClientStack.LindenUDP { @@ -63,7 +63,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); /// Holds the actual unacked packet data, sorted by sequence number private Dictionary m_packets = new Dictionary(); @@ -169,8 +169,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } - //if (expiredPackets != null) - // m_log.DebugFormat("[UNACKED PACKET COLLECTION]: Found {0} expired packets on timeout of {1}", expiredPackets.Count, timeoutMS); + // if (expiredPackets != null) + // m_log.DebugFormat("[UNACKED PACKET COLLECTION]: Found {0} expired packets on timeout of {1}", expiredPackets.Count, timeoutMS); return expiredPackets; } @@ -212,14 +212,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP } else { - m_log.WarnFormat("[UNACKED PACKET COLLECTION]: found null packet for sequence number {0} to ack", - pendingAcknowledgement.SequenceNumber); + // m_log.WarnFormat("[UNACKED PACKET COLLECTION]: found null packet for sequence number {0} to ack", + // pendingAcknowledgement.SequenceNumber); } } else { - m_log.WarnFormat("[UNACKED PACKET COLLECTION]: Could not find packet with sequence number {0} to ack", - pendingAcknowledgement.SequenceNumber); + // m_log.WarnFormat("[UNACKED PACKET COLLECTION]: Could not find packet with sequence number {0} to ack", + // pendingAcknowledgement.SequenceNumber); } }