From 024c12abc3aa42432e55e322141cad1edeb5bad1 Mon Sep 17 00:00:00 2001 From: Mic Bowman Date: Mon, 25 Apr 2011 10:44:41 -0700 Subject: Cleaned up various configuration options. Removed the category throttle limits because the only ones used now are the defaults (which are overwritten by the client throttles anyway). Updated the default rates to correspond to about 350kbps. Also added a configuration to disable adaptive throttle. The default is the previous behavior (no adaptation). --- .../Region/ClientStack/LindenUDP/LLUDPClient.cs | 13 ++-- .../Region/ClientStack/LindenUDP/ThrottleRates.cs | 80 ++++------------------ .../Region/ClientStack/LindenUDP/TokenBucket.cs | 19 +++-- .../Agent/UDP/Linden/LindenUDPInfoModule.cs | 18 ++--- 4 files changed, 43 insertions(+), 87 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs index 103ec66..494cb0c 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs @@ -181,9 +181,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_maxRTO = maxRTO; // Create a token bucket throttle for this client that has the scene token bucket as a parent - m_throttleClient = new AdaptiveTokenBucket(parentThrottle, rates.TotalLimit); + m_throttleClient = new AdaptiveTokenBucket(parentThrottle, rates.Total, rates.AdaptiveThrottlesEnabled); // Create a token bucket throttle for the total categary with the client bucket as a throttle - m_throttleCategory = new TokenBucket(m_throttleClient, rates.TotalLimit); + m_throttleCategory = new TokenBucket(m_throttleClient, rates.Total); // Create an array of token buckets for this clients different throttle categories m_throttleCategories = new TokenBucket[THROTTLE_CATEGORY_COUNT]; @@ -194,7 +194,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // Initialize the packet outboxes, where packets sit while they are waiting for tokens m_packetOutboxes[i] = new OpenSim.Framework.LocklessQueue(); // Initialize the token buckets that control the throttling for each category - m_throttleCategories[i] = new TokenBucket(m_throttleCategory, rates.GetLimit(type)); + m_throttleCategories[i] = new TokenBucket(m_throttleCategory, rates.GetRate(type)); } // Default the retransmission timeout to three seconds @@ -341,12 +341,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP task = Math.Max(task, LLUDPServer.MTU); texture = Math.Max(texture, LLUDPServer.MTU); asset = Math.Max(asset, LLUDPServer.MTU); - state = Math.Max(state, LLUDPServer.MTU); - int total = resend + land + wind + cloud + task + texture + asset + state; + int total = resend + land + wind + cloud + task + texture + asset; - //m_log.DebugFormat("[LLUDPCLIENT]: {0} is setting throttles. Resend={1}, Land={2}, Wind={3}, Cloud={4}, Task={5}, Texture={6}, Asset={7}, State={8}, Total={9}", - // AgentID, resend, land, wind, cloud, task, texture, asset, state, total); + //m_log.DebugFormat("[LLUDPCLIENT]: {0} is setting throttles. Resend={1}, Land={2}, Wind={3}, Cloud={4}, Task={5}, Texture={6}, Asset={7}, Total={8}", + // AgentID, resend, land, wind, cloud, task, texture, asset, total); // Update the token buckets with new throttle values TokenBucket bucket; diff --git a/OpenSim/Region/ClientStack/LindenUDP/ThrottleRates.cs b/OpenSim/Region/ClientStack/LindenUDP/ThrottleRates.cs index aaf6e26..c9aac0b 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/ThrottleRates.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/ThrottleRates.cs @@ -52,30 +52,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP public int Texture; /// Drip rate for asset packets public int Asset; - /// Drip rate for state packets - public int State; + /// Drip rate for the parent token bucket public int Total; - /// Maximum burst rate for resent packets - public int ResendLimit; - /// Maximum burst rate for land packets - public int LandLimit; - /// Maximum burst rate for wind packets - public int WindLimit; - /// Maximum burst rate for cloud packets - public int CloudLimit; - /// Maximum burst rate for task (state and transaction) packets - public int TaskLimit; - /// Maximum burst rate for texture packets - public int TextureLimit; - /// Maximum burst rate for asset packets - public int AssetLimit; - /// Maximum burst rate for state packets - public int StateLimit; - /// Burst rate for the parent token bucket - public int TotalLimit; - + /// Flag used to enable adaptive throttles + public bool AdaptiveThrottlesEnabled; + /// /// Default constructor /// @@ -86,26 +69,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP { IConfig throttleConfig = config.Configs["ClientStack.LindenUDP"]; - Resend = throttleConfig.GetInt("resend_default", 12500); - Land = throttleConfig.GetInt("land_default", 1000); - Wind = throttleConfig.GetInt("wind_default", 1000); - Cloud = throttleConfig.GetInt("cloud_default", 1000); - Task = throttleConfig.GetInt("task_default", 1000); - Texture = throttleConfig.GetInt("texture_default", 1000); - Asset = throttleConfig.GetInt("asset_default", 1000); - State = throttleConfig.GetInt("state_default", 1000); - - ResendLimit = throttleConfig.GetInt("resend_limit", 18750); - LandLimit = throttleConfig.GetInt("land_limit", 29750); - WindLimit = throttleConfig.GetInt("wind_limit", 18750); - CloudLimit = throttleConfig.GetInt("cloud_limit", 18750); - TaskLimit = throttleConfig.GetInt("task_limit", 18750); - TextureLimit = throttleConfig.GetInt("texture_limit", 55750); - AssetLimit = throttleConfig.GetInt("asset_limit", 27500); - StateLimit = throttleConfig.GetInt("state_limit", 37000); + Resend = throttleConfig.GetInt("resend_default", 6625); + Land = throttleConfig.GetInt("land_default", 9125); + Wind = throttleConfig.GetInt("wind_default", 1750); + Cloud = throttleConfig.GetInt("cloud_default", 1750); + Task = throttleConfig.GetInt("task_default", 18500); + Texture = throttleConfig.GetInt("texture_default", 18500); + Asset = throttleConfig.GetInt("asset_default", 10500); Total = throttleConfig.GetInt("client_throttle_max_bps", 0); - TotalLimit = Total; + + AdaptiveThrottlesEnabled = throttleConfig.GetBoolean("enable_adaptive_throttles", false); } catch (Exception) { } } @@ -128,34 +102,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP return Texture; case ThrottleOutPacketType.Asset: return Asset; - case ThrottleOutPacketType.State: - return State; - case ThrottleOutPacketType.Unknown: - default: - return 0; - } - } - - public int GetLimit(ThrottleOutPacketType type) - { - switch (type) - { - case ThrottleOutPacketType.Resend: - return ResendLimit; - case ThrottleOutPacketType.Land: - return LandLimit; - case ThrottleOutPacketType.Wind: - return WindLimit; - case ThrottleOutPacketType.Cloud: - return CloudLimit; - case ThrottleOutPacketType.Task: - return TaskLimit; - case ThrottleOutPacketType.Texture: - return TextureLimit; - case ThrottleOutPacketType.Asset: - return AssetLimit; - case ThrottleOutPacketType.State: - return StateLimit; case ThrottleOutPacketType.Unknown: default: return 0; diff --git a/OpenSim/Region/ClientStack/LindenUDP/TokenBucket.cs b/OpenSim/Region/ClientStack/LindenUDP/TokenBucket.cs index 677d3d1..2ec79ab 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/TokenBucket.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/TokenBucket.cs @@ -340,6 +340,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP set { m_maxDripRate = (value == 0 ? 0 : Math.Max(value,m_minimumFlow)); } } + private bool m_enabled = false; + // // // @@ -357,9 +359,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP // // // - public AdaptiveTokenBucket(TokenBucket parent, Int64 maxDripRate) : base(parent,m_minimumFlow) + public AdaptiveTokenBucket(TokenBucket parent, Int64 maxDripRate, bool enabled) : base(parent,maxDripRate) { - MaxDripRate = maxDripRate; + m_enabled = enabled; + + if (m_enabled) + { + m_log.WarnFormat("[TOKENBUCKET] Adaptive throttle enabled"); + MaxDripRate = maxDripRate; + AdjustedDripRate = m_minimumFlow; + } } // @@ -368,7 +377,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP public void ExpirePackets(Int32 count) { // m_log.WarnFormat("[ADAPTIVEBUCKET] drop {0} by {1} expired packets",AdjustedDripRate,count); - AdjustedDripRate = (Int64) (AdjustedDripRate / Math.Pow(2,count)); + if (m_enabled) + AdjustedDripRate = (Int64) (AdjustedDripRate / Math.Pow(2,count)); } // @@ -376,7 +386,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP // public void AcknowledgePackets(Int32 count) { - AdjustedDripRate = AdjustedDripRate + count; + if (m_enabled) + AdjustedDripRate = AdjustedDripRate + count; } } } diff --git a/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs b/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs index ddbc079..db17d8f 100644 --- a/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs +++ b/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs @@ -398,7 +398,7 @@ namespace OpenSim.Region.CoreModules.UDP.Linden if (client is LLClientView) { LLClientView llClient = client as LLClientView; - + if (firstClient) { report.AppendLine(GetServerThrottlesReport(llClient.UDPServer)); @@ -451,7 +451,7 @@ namespace OpenSim.Region.CoreModules.UDP.Linden int maxRegionNameLength = 14; int maxTypeLength = 4; - string name = "SERVER AGENT LIMITS"; + string name = "SERVER AGENT RATES"; report.Append(GetColumnEntry(name, maxNameLength, columnPadding)); report.Append(GetColumnEntry("-", maxRegionNameLength, columnPadding)); @@ -461,13 +461,13 @@ namespace OpenSim.Region.CoreModules.UDP.Linden report.AppendFormat( "{0,7} {1,8} {2,7} {3,7} {4,7} {5,7} {6,9} {7,7}", (throttleRates.Total * 8) / 1000, - (throttleRates.ResendLimit * 8) / 1000, - (throttleRates.LandLimit * 8) / 1000, - (throttleRates.WindLimit * 8) / 1000, - (throttleRates.CloudLimit * 8) / 1000, - (throttleRates.TaskLimit * 8) / 1000, - (throttleRates.TextureLimit * 8) / 1000, - (throttleRates.AssetLimit * 8) / 1000); + (throttleRates.Resend * 8) / 1000, + (throttleRates.Land * 8) / 1000, + (throttleRates.Wind * 8) / 1000, + (throttleRates.Cloud * 8) / 1000, + (throttleRates.Task * 8) / 1000, + (throttleRates.Texture * 8) / 1000, + (throttleRates.Asset * 8) / 1000); return report.ToString(); } -- cgit v1.1