* 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
prioritization
John Hurliman 2009-10-16 12:20:01 -07:00
parent 5a4fda9dc3
commit a18489dc9b
4 changed files with 51 additions and 37 deletions

View File

@ -401,6 +401,7 @@ namespace OpenSim.Data.MySQL
Dictionary<UUID, SceneObjectGroup> objects = new Dictionary<UUID, SceneObjectGroup>(); Dictionary<UUID, SceneObjectGroup> objects = new Dictionary<UUID, SceneObjectGroup>();
Dictionary<UUID, SceneObjectPart> prims = new Dictionary<UUID, SceneObjectPart>(); Dictionary<UUID, SceneObjectPart> prims = new Dictionary<UUID, SceneObjectPart>();
SceneObjectGroup grp = null; SceneObjectGroup grp = null;
int count = 0;
lock (m_Connection) lock (m_Connection)
{ {
@ -463,6 +464,10 @@ namespace OpenSim.Data.MySQL
if (link != 0) if (link != 0)
prim.LinkNum = link; prim.LinkNum = link;
} }
++count;
if (count % 5000 == 0)
m_log.Debug("[REGION DB]: Loaded " + count + " prims...");
} }
} }

View File

@ -3124,7 +3124,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
avp.Sender.IsTrial = false; avp.Sender.IsTrial = false;
avp.Sender.ID = agentID; avp.Sender.ID = agentID;
OutPacket(avp, ThrottleOutPacketType.State); OutPacket(avp, ThrottleOutPacketType.Task);
} }
public void SendAnimations(UUID[] animations, int[] seqs, UUID sourceAgentId, UUID[] objectIDs) public void SendAnimations(UUID[] animations, int[] seqs, UUID sourceAgentId, UUID[] objectIDs)

View File

@ -170,7 +170,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{ {
ThrottleOutPacketType type = (ThrottleOutPacketType)i; ThrottleOutPacketType type = (ThrottleOutPacketType)i;
// Initialize the packet outboxes, where packets sit while they are waiting for tokens
m_packetOutboxes[i] = new OpenSim.Framework.LocklessQueue<OutgoingPacket>(); m_packetOutboxes[i] = new OpenSim.Framework.LocklessQueue<OutgoingPacket>();
// Initialize the token buckets that control the throttling for each category
m_throttleCategories[i] = new TokenBucket(m_throttle, rates.GetLimit(type), rates.GetRate(type)); 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); int state = (int)((float)task * STATE_TASK_PERCENTAGE);
task -= state; task -= state;
int ceiling = Int32.MaxValue; // Make sure none of the throttles are set below our packet MTU,
if (m_defaultThrottleRates.Total != 0) // otherwise a throttle could become permanently clogged
{ resend = Math.Max(resend, Packet.MTU);
ceiling = m_defaultThrottleRates.Total; land = Math.Max(land, Packet.MTU);
if (ceiling < Packet.MTU) ceiling = Packet.MTU; wind = Math.Max(wind, Packet.MTU);
} cloud = Math.Max(cloud, Packet.MTU);
task = Math.Max(task, Packet.MTU);
resend = Utils.Clamp(resend, Packet.MTU, ceiling); texture = Math.Max(texture, Packet.MTU);
land = Utils.Clamp(land, Packet.MTU, ceiling); asset = Math.Max(asset, Packet.MTU);
wind = Utils.Clamp(wind, Packet.MTU, ceiling); state = Math.Max(state, Packet.MTU);
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);
int total = resend + land + wind + cloud + task + texture + asset + state; 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}", 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); AgentID, resend, land, wind, cloud, task, texture, asset, state, total);
SetThrottle(ThrottleOutPacketType.Resend, resend, resend); // Update the token buckets with new throttle values
SetThrottle(ThrottleOutPacketType.Land, land, land); TokenBucket bucket;
SetThrottle(ThrottleOutPacketType.Wind, wind, wind);
SetThrottle(ThrottleOutPacketType.Cloud, cloud, cloud); bucket = m_throttle;
SetThrottle(ThrottleOutPacketType.Task, task, taskTotal); bucket.MaxBurst = total;
SetThrottle(ThrottleOutPacketType.Texture, texture, texture);
SetThrottle(ThrottleOutPacketType.Asset, asset, asset); bucket = m_throttleCategories[(int)ThrottleOutPacketType.Resend];
SetThrottle(ThrottleOutPacketType.State, state, taskTotal); 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() public byte[] GetThrottlesPacked()
@ -342,17 +362,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
return data; 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) public bool EnqueueOutgoing(OutgoingPacket packet)
{ {
int category = (int)packet.Category; int category = (int)packet.Category;

View File

@ -513,7 +513,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
IClientAPI client; IClientAPI client;
if (!m_scene.ClientManager.TryGetValue(address, out client) || !(client is LLClientView)) 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"); " in " + m_scene.RegionInfo.RegionName + ", currently tracking " + m_scene.ClientManager.Count + " clients");
return; return;
} }