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).
bulletsim
Mic Bowman 2011-04-25 10:44:41 -07:00
parent 1d7c83c39f
commit 024c12abc3
5 changed files with 59 additions and 109 deletions

View File

@ -181,9 +181,9 @@ 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
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 // 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 // Create an array of token buckets for this clients different throttle categories
m_throttleCategories = new TokenBucket[THROTTLE_CATEGORY_COUNT]; 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 // 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 // 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 // Default the retransmission timeout to three seconds
@ -341,12 +341,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
task = Math.Max(task, LLUDPServer.MTU); task = Math.Max(task, LLUDPServer.MTU);
texture = Math.Max(texture, LLUDPServer.MTU); texture = Math.Max(texture, LLUDPServer.MTU);
asset = Math.Max(asset, 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}", //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, state, total); // AgentID, resend, land, wind, cloud, task, texture, asset, total);
// Update the token buckets with new throttle values // Update the token buckets with new throttle values
TokenBucket bucket; TokenBucket bucket;

View File

@ -52,29 +52,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public int Texture; public int Texture;
/// <summary>Drip rate for asset packets</summary> /// <summary>Drip rate for asset packets</summary>
public int Asset; public int Asset;
/// <summary>Drip rate for state packets</summary>
public int State;
/// <summary>Drip rate for the parent token bucket</summary> /// <summary>Drip rate for the parent token bucket</summary>
public int Total; public int Total;
/// <summary>Maximum burst rate for resent packets</summary> /// <summary>Flag used to enable adaptive throttles</summary>
public int ResendLimit; public bool AdaptiveThrottlesEnabled;
/// <summary>Maximum burst rate for land packets</summary>
public int LandLimit;
/// <summary>Maximum burst rate for wind packets</summary>
public int WindLimit;
/// <summary>Maximum burst rate for cloud packets</summary>
public int CloudLimit;
/// <summary>Maximum burst rate for task (state and transaction) packets</summary>
public int TaskLimit;
/// <summary>Maximum burst rate for texture packets</summary>
public int TextureLimit;
/// <summary>Maximum burst rate for asset packets</summary>
public int AssetLimit;
/// <summary>Maximum burst rate for state packets</summary>
public int StateLimit;
/// <summary>Burst rate for the parent token bucket</summary>
public int TotalLimit;
/// <summary> /// <summary>
/// Default constructor /// Default constructor
@ -86,26 +69,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{ {
IConfig throttleConfig = config.Configs["ClientStack.LindenUDP"]; IConfig throttleConfig = config.Configs["ClientStack.LindenUDP"];
Resend = throttleConfig.GetInt("resend_default", 12500); Resend = throttleConfig.GetInt("resend_default", 6625);
Land = throttleConfig.GetInt("land_default", 1000); Land = throttleConfig.GetInt("land_default", 9125);
Wind = throttleConfig.GetInt("wind_default", 1000); Wind = throttleConfig.GetInt("wind_default", 1750);
Cloud = throttleConfig.GetInt("cloud_default", 1000); Cloud = throttleConfig.GetInt("cloud_default", 1750);
Task = throttleConfig.GetInt("task_default", 1000); Task = throttleConfig.GetInt("task_default", 18500);
Texture = throttleConfig.GetInt("texture_default", 1000); Texture = throttleConfig.GetInt("texture_default", 18500);
Asset = throttleConfig.GetInt("asset_default", 1000); Asset = throttleConfig.GetInt("asset_default", 10500);
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);
Total = throttleConfig.GetInt("client_throttle_max_bps", 0); Total = throttleConfig.GetInt("client_throttle_max_bps", 0);
TotalLimit = Total;
AdaptiveThrottlesEnabled = throttleConfig.GetBoolean("enable_adaptive_throttles", false);
} }
catch (Exception) { } catch (Exception) { }
} }
@ -128,34 +102,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
return Texture; return Texture;
case ThrottleOutPacketType.Asset: case ThrottleOutPacketType.Asset:
return 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: case ThrottleOutPacketType.Unknown:
default: default:
return 0; return 0;

View File

@ -340,6 +340,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
set { m_maxDripRate = (value == 0 ? 0 : Math.Max(value,m_minimumFlow)); } set { m_maxDripRate = (value == 0 ? 0 : Math.Max(value,m_minimumFlow)); }
} }
private bool m_enabled = false;
// <summary> // <summary>
// //
// </summary> // </summary>
@ -357,9 +359,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// <summary> // <summary>
// //
// </summary> // </summary>
public AdaptiveTokenBucket(TokenBucket parent, Int64 maxDripRate) : base(parent,m_minimumFlow) public AdaptiveTokenBucket(TokenBucket parent, Int64 maxDripRate, bool enabled) : base(parent,maxDripRate)
{ {
m_enabled = enabled;
if (m_enabled)
{
m_log.WarnFormat("[TOKENBUCKET] Adaptive throttle enabled");
MaxDripRate = maxDripRate; MaxDripRate = maxDripRate;
AdjustedDripRate = m_minimumFlow;
}
} }
// <summary> // <summary>
@ -368,6 +377,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public void ExpirePackets(Int32 count) public void ExpirePackets(Int32 count)
{ {
// m_log.WarnFormat("[ADAPTIVEBUCKET] drop {0} by {1} expired packets",AdjustedDripRate,count); // m_log.WarnFormat("[ADAPTIVEBUCKET] drop {0} by {1} expired packets",AdjustedDripRate,count);
if (m_enabled)
AdjustedDripRate = (Int64) (AdjustedDripRate / Math.Pow(2,count)); AdjustedDripRate = (Int64) (AdjustedDripRate / Math.Pow(2,count));
} }
@ -376,6 +386,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// </summary> // </summary>
public void AcknowledgePackets(Int32 count) public void AcknowledgePackets(Int32 count)
{ {
if (m_enabled)
AdjustedDripRate = AdjustedDripRate + count; AdjustedDripRate = AdjustedDripRate + count;
} }
} }

View File

@ -451,7 +451,7 @@ namespace OpenSim.Region.CoreModules.UDP.Linden
int maxRegionNameLength = 14; int maxRegionNameLength = 14;
int maxTypeLength = 4; int maxTypeLength = 4;
string name = "SERVER AGENT LIMITS"; string name = "SERVER AGENT RATES";
report.Append(GetColumnEntry(name, maxNameLength, columnPadding)); report.Append(GetColumnEntry(name, maxNameLength, columnPadding));
report.Append(GetColumnEntry("-", maxRegionNameLength, columnPadding)); report.Append(GetColumnEntry("-", maxRegionNameLength, columnPadding));
@ -461,13 +461,13 @@ namespace OpenSim.Region.CoreModules.UDP.Linden
report.AppendFormat( report.AppendFormat(
"{0,7} {1,8} {2,7} {3,7} {4,7} {5,7} {6,9} {7,7}", "{0,7} {1,8} {2,7} {3,7} {4,7} {5,7} {6,9} {7,7}",
(throttleRates.Total * 8) / 1000, (throttleRates.Total * 8) / 1000,
(throttleRates.ResendLimit * 8) / 1000, (throttleRates.Resend * 8) / 1000,
(throttleRates.LandLimit * 8) / 1000, (throttleRates.Land * 8) / 1000,
(throttleRates.WindLimit * 8) / 1000, (throttleRates.Wind * 8) / 1000,
(throttleRates.CloudLimit * 8) / 1000, (throttleRates.Cloud * 8) / 1000,
(throttleRates.TaskLimit * 8) / 1000, (throttleRates.Task * 8) / 1000,
(throttleRates.TextureLimit * 8) / 1000, (throttleRates.Texture * 8) / 1000,
(throttleRates.AssetLimit * 8) / 1000); (throttleRates.Asset * 8) / 1000);
return report.ToString(); return report.ToString();
} }

View File

@ -362,30 +362,24 @@
; ;
;client_throttle_max_bps = 196608 ;client_throttle_max_bps = 196608
; Per-client bytes per second rates for the various throttle categories. ; Adaptive throttling attempts to limit network overload when multiple
; These are default values that will be overriden by clients ; clients login by starting each connection more slowly. Disabled by
; default
; ;
;resend_default = 12500 ;enable_adaptive_throttles = true
;land_default = 1000
;wind_default = 1000
;cloud_default = 1000
;task_default = 1000
;texture_default = 1000
;asset_default = 1000
;state_default = 1000
; Per-client maximum burst rates in bytes per second for the various ; Per-client bytes per second rates for the various throttle categories.
; throttle categories. These are default values that will be overriden by ; These are default values that will be overriden by clients. These
; clients ; defaults are approximately equivalent to the throttles set by the Imprudence
; ; viewer when maximum bandwidth is set to 350kbps
;resend_limit = 18750
;land_limit = 29750 ;resend_default = 6625
;wind_limit = 18750 ;land_default = 9125
;cloud_limit = 18750 ;wind_default = 1750
;task_limit = 18750 ;cloud_default = 1750
;texture_limit = 55750 ;task_default = 18500
;asset_limit = 27500 ;texture_default = 18500
;state_limit = 37000 ;asset_default = 10500
; Configures how ObjectUpdates are aggregated. These numbers ; Configures how ObjectUpdates are aggregated. These numbers
; do not literally mean how many updates will be put in each ; do not literally mean how many updates will be put in each