From a18489dc9badfccd775145f5a1a800a763d0c554 Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Fri, 16 Oct 2009 12:20:01 -0700 Subject: * Change appearance packets from State to Task. This will hopefully fix the cloud issues * Changed the throttling logic to obey the requested client bandwidth limit but also share bandwidth between some of the categories to improve throughput on high prim or heavily trafficked regions --- OpenSim/Data/MySQL/MySQLLegacyRegionData.cs | 5 ++ .../Region/ClientStack/LindenUDP/LLClientView.cs | 2 +- .../Region/ClientStack/LindenUDP/LLUDPClient.cs | 79 ++++++++++++---------- .../Region/ClientStack/LindenUDP/LLUDPServer.cs | 2 +- 4 files changed, 51 insertions(+), 37 deletions(-) diff --git a/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs b/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs index fe0914b..839ac7f 100644 --- a/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs +++ b/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs @@ -401,6 +401,7 @@ namespace OpenSim.Data.MySQL Dictionary objects = new Dictionary(); Dictionary prims = new Dictionary(); SceneObjectGroup grp = null; + int count = 0; lock (m_Connection) { @@ -463,6 +464,10 @@ namespace OpenSim.Data.MySQL if (link != 0) prim.LinkNum = link; } + + ++count; + if (count % 5000 == 0) + m_log.Debug("[REGION DB]: Loaded " + count + " prims..."); } } diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 58fd2e7..630b6e6 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -3124,7 +3124,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP avp.Sender.IsTrial = false; avp.Sender.ID = agentID; - OutPacket(avp, ThrottleOutPacketType.State); + OutPacket(avp, ThrottleOutPacketType.Task); } public void SendAnimations(UUID[] animations, int[] seqs, UUID sourceAgentId, UUID[] objectIDs) diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs index 4eee6b6..8c42ca4 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs @@ -170,7 +170,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP { ThrottleOutPacketType type = (ThrottleOutPacketType)i; + // 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_throttle, rates.GetLimit(type), rates.GetRate(type)); } @@ -293,36 +295,54 @@ namespace OpenSim.Region.ClientStack.LindenUDP int state = (int)((float)task * STATE_TASK_PERCENTAGE); task -= state; - int ceiling = Int32.MaxValue; - if (m_defaultThrottleRates.Total != 0) - { - ceiling = m_defaultThrottleRates.Total; - if (ceiling < Packet.MTU) ceiling = Packet.MTU; - } - - resend = Utils.Clamp(resend, Packet.MTU, ceiling); - land = Utils.Clamp(land, Packet.MTU, ceiling); - wind = Utils.Clamp(wind, Packet.MTU, ceiling); - cloud = Utils.Clamp(cloud, Packet.MTU, ceiling); - task = Utils.Clamp(task, Packet.MTU, ceiling); - texture = Utils.Clamp(texture, Packet.MTU, ceiling); - asset = Utils.Clamp(asset, Packet.MTU, ceiling); - state = Utils.Clamp(state, Packet.MTU, ceiling); + // Make sure none of the throttles are set below our packet MTU, + // otherwise a throttle could become permanently clogged + resend = Math.Max(resend, Packet.MTU); + land = Math.Max(land, Packet.MTU); + wind = Math.Max(wind, Packet.MTU); + cloud = Math.Max(cloud, Packet.MTU); + task = Math.Max(task, Packet.MTU); + texture = Math.Max(texture, Packet.MTU); + asset = Math.Max(asset, Packet.MTU); + state = Math.Max(state, Packet.MTU); int total = resend + land + wind + cloud + task + texture + asset + state; - int taskTotal = task + state; 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); - SetThrottle(ThrottleOutPacketType.Resend, resend, resend); - SetThrottle(ThrottleOutPacketType.Land, land, land); - SetThrottle(ThrottleOutPacketType.Wind, wind, wind); - SetThrottle(ThrottleOutPacketType.Cloud, cloud, cloud); - SetThrottle(ThrottleOutPacketType.Task, task, taskTotal); - SetThrottle(ThrottleOutPacketType.Texture, texture, texture); - SetThrottle(ThrottleOutPacketType.Asset, asset, asset); - SetThrottle(ThrottleOutPacketType.State, state, taskTotal); + // Update the token buckets with new throttle values + TokenBucket bucket; + + bucket = m_throttle; + bucket.MaxBurst = total; + + bucket = m_throttleCategories[(int)ThrottleOutPacketType.Resend]; + bucket.DripRate = bucket.MaxBurst = resend; + + bucket = m_throttleCategories[(int)ThrottleOutPacketType.Land]; + bucket.DripRate = bucket.MaxBurst = land; + + bucket = m_throttleCategories[(int)ThrottleOutPacketType.Wind]; + bucket.DripRate = bucket.MaxBurst = wind; + + bucket = m_throttleCategories[(int)ThrottleOutPacketType.Cloud]; + bucket.DripRate = bucket.MaxBurst = cloud; + + bucket = m_throttleCategories[(int)ThrottleOutPacketType.Asset]; + bucket.DripRate = bucket.MaxBurst = asset; + + bucket = m_throttleCategories[(int)ThrottleOutPacketType.Task]; + bucket.DripRate = task + state + texture; + bucket.MaxBurst = task + state + texture; + + bucket = m_throttleCategories[(int)ThrottleOutPacketType.State]; + bucket.DripRate = state + texture; + bucket.MaxBurst = state + texture; + + bucket = m_throttleCategories[(int)ThrottleOutPacketType.Texture]; + bucket.DripRate = texture; + bucket.MaxBurst = texture; } public byte[] GetThrottlesPacked() @@ -342,17 +362,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP return data; } - public void SetThrottle(ThrottleOutPacketType category, int rate, int maxBurst) - { - int i = (int)category; - if (i >= 0 && i < m_throttleCategories.Length) - { - TokenBucket bucket = m_throttleCategories[(int)category]; - bucket.DripRate = rate; - bucket.MaxBurst = maxBurst; - } - } - public bool EnqueueOutgoing(OutgoingPacket packet) { int category = (int)packet.Category; diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs index 545a0bc..ee3e754 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs @@ -513,7 +513,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP IClientAPI client; if (!m_scene.ClientManager.TryGetValue(address, out client) || !(client is LLClientView)) { - m_log.Warn("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + + m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + " in " + m_scene.RegionInfo.RegionName + ", currently tracking " + m_scene.ClientManager.Count + " clients"); return; } -- cgit v1.1