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/Tests/ThrottleTests.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs b/OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs index 0560b9b..17e1af6 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( -- cgit v1.1 From 75df04f0b372625ed753b65bb84385fa258a58ea Mon Sep 17 00:00:00 2001 From: Mic Bowman Date: Tue, 30 Dec 2014 10:03:37 -0800 Subject: Fix the throttle tests. Remove the hardcoded constant multipliers and compute the expected values without depending on the token bucket code. --- .../ClientStack/Linden/UDP/Tests/ThrottleTests.cs | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs b/OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs index 17e1af6..9241e37 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, -- cgit v1.1 From 5bb73793c73bfb40d90c99c0fd1f2f21425a2c0f Mon Sep 17 00:00:00 2001 From: Mic Bowman Date: Tue, 30 Dec 2014 14:43:42 -0800 Subject: 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. --- OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs b/OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs index 9241e37..3c82a78 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, -- cgit v1.1