try to make sense of throttle rate limits

avinationmerge
UbitUmarov 2014-08-28 18:51:55 +01:00
parent 5a2d4fd47f
commit 9839904ebe
2 changed files with 15 additions and 4 deletions

View File

@ -217,6 +217,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
m_maxRTO = maxRTO; m_maxRTO = maxRTO;
// Create a token bucket throttle for this client that has the scene token bucket as a parent // Create a token bucket throttle for this client that has the scene token bucket as a parent
// 2500000 bits/s max
m_throttleClient = new AdaptiveTokenBucket(parentThrottle, rates.Total, rates.AdaptiveThrottlesEnabled); 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 // Create a token bucket throttle for the total categary with the client bucket as a throttle
m_throttleCategory = new TokenBucket(m_throttleClient, 0); m_throttleCategory = new TokenBucket(m_throttleClient, 0);
@ -225,6 +226,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
m_cannibalrate = rates.CannibalizeTextureRate; m_cannibalrate = rates.CannibalizeTextureRate;
long totalrate = 0;
long catrate = 0;
for (int i = 0; i < THROTTLE_CATEGORY_COUNT; i++) for (int i = 0; i < THROTTLE_CATEGORY_COUNT; i++)
{ {
ThrottleOutPacketType type = (ThrottleOutPacketType)i; ThrottleOutPacketType type = (ThrottleOutPacketType)i;
@ -232,9 +236,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// Initialize the packet outboxes, where packets sit while they are waiting for tokens // Initialize the packet outboxes, where packets sit while they are waiting for tokens
m_packetOutboxes[i] = new DoubleLocklessQueue<OutgoingPacket>(); m_packetOutboxes[i] = new DoubleLocklessQueue<OutgoingPacket>();
// Initialize the token buckets that control the throttling for each category // Initialize the token buckets that control the throttling for each category
m_throttleCategories[i] = new TokenBucket(m_throttleCategory, rates.GetRate(type)); catrate = rates.GetRate(type);
totalrate += catrate;
m_throttleCategories[i] = new TokenBucket(m_throttleCategory, catrate);
} }
m_throttleCategory.RequestedDripRate = totalrate;
// Default the retransmission timeout to one second // Default the retransmission timeout to one second
RTO = m_defaultRTO; RTO = m_defaultRTO;
@ -380,7 +388,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
task = task + (int)(m_cannibalrate * texture); task = task + (int)(m_cannibalrate * texture);
texture = (int)((1 - m_cannibalrate) * texture); texture = (int)((1 - m_cannibalrate) * texture);
// int total = resend + land + wind + cloud + task + texture + asset; 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}, Total={8}", //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); // AgentID, resend, land, wind, cloud, task, texture, asset, total);
@ -409,6 +417,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
bucket = m_throttleCategories[(int)ThrottleOutPacketType.Texture]; bucket = m_throttleCategories[(int)ThrottleOutPacketType.Texture];
bucket.RequestedDripRate = texture; bucket.RequestedDripRate = texture;
m_throttleCategory.RequestedDripRate = total;
// Reset the packed throttles cached data // Reset the packed throttles cached data
m_packedThrottles = null; m_packedThrottles = null;
} }

View File

@ -80,7 +80,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
Texture = throttleConfig.GetInt("texture_default", 18500); Texture = throttleConfig.GetInt("texture_default", 18500);
Asset = throttleConfig.GetInt("asset_default", 10500); Asset = throttleConfig.GetInt("asset_default", 10500);
Total = throttleConfig.GetInt("client_throttle_max_bps", 0); // 2500000 bps max
Total = throttleConfig.GetInt("client_throttle_max_bps",312500);
AdaptiveThrottlesEnabled = throttleConfig.GetBoolean("enable_adaptive_throttles", false); AdaptiveThrottlesEnabled = throttleConfig.GetBoolean("enable_adaptive_throttles", false);