lludp: change burst, make it per category (overall reduction)

0.9.1.0-post-fixes
UbitUmarov 2019-04-16 19:07:26 +01:00
parent 37fb937e0d
commit 11cad57c9c
2 changed files with 47 additions and 22 deletions

View File

@ -260,7 +260,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// Initialize the packet outboxes, where packets sit while they are waiting for tokens
m_packetOutboxes[i] = new DoubleLocklessQueue<OutgoingPacket>();
// Initialize the token buckets that control the throttling for each category
m_throttleCategories[i] = new TokenBucket(m_throttleClient, rates.GetRate(type), m_burst);
//m_throttleCategories[i] = new TokenBucket(m_throttleClient, rates.GetRate(type), m_burst);
float rate = rates.GetRate(type);
float burst = rate * rates.BrustTime;
m_throttleCategories[i] = new TokenBucket(m_throttleClient, rate , burst);
}
// Default the retransmission timeout to one second
@ -443,7 +446,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
int total = resend + land + wind + cloud + task + texture + asset;
float m_burst = total * m_burstTime;
//float m_burst = total * m_burstTime;
if (ThrottleDebugLevel > 0)
{
@ -453,7 +456,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
TokenBucket bucket;
/*
bucket = m_throttleCategories[(int)ThrottleOutPacketType.Resend];
bucket.RequestedDripRate = resend;
bucket.RequestedBurst = m_burst;
@ -481,6 +484,34 @@ namespace OpenSim.Region.ClientStack.LindenUDP
bucket = m_throttleCategories[(int)ThrottleOutPacketType.Texture];
bucket.RequestedDripRate = texture;
bucket.RequestedBurst = m_burst;
*/
bucket = m_throttleCategories[(int)ThrottleOutPacketType.Resend];
bucket.RequestedDripRate = resend;
bucket.RequestedBurst = resend * m_burstTime;
bucket = m_throttleCategories[(int)ThrottleOutPacketType.Land];
bucket.RequestedDripRate = land;
bucket.RequestedBurst = land * m_burstTime;
bucket = m_throttleCategories[(int)ThrottleOutPacketType.Wind];
bucket.RequestedDripRate = wind;
bucket.RequestedBurst = wind * m_burstTime;
bucket = m_throttleCategories[(int)ThrottleOutPacketType.Cloud];
bucket.RequestedDripRate = cloud;
bucket.RequestedBurst = cloud * m_burstTime;
bucket = m_throttleCategories[(int)ThrottleOutPacketType.Asset];
bucket.RequestedDripRate = asset;
bucket.RequestedBurst = asset * m_burstTime;
bucket = m_throttleCategories[(int)ThrottleOutPacketType.Task];
bucket.RequestedDripRate = task;
bucket.RequestedBurst = task * m_burstTime;
bucket = m_throttleCategories[(int)ThrottleOutPacketType.Texture];
bucket.RequestedDripRate = texture;
bucket.RequestedBurst = texture * m_burstTime;
// Reset the packed throttles cached data
m_packedThrottles = null;

View File

@ -45,22 +45,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP
private static Int32 m_counter = 0;
// private Int32 m_identifier;
protected const float m_timeScale = 1e-3f;
/// <summary>
/// This is the number of m_minimumDripRate bytes
/// allowed in a burst
/// roughtly, with this settings, the maximum time system will take
/// to recheck a bucket in ms
///
/// minimum recovery rate, ie bandwith
/// </summary>
protected const float m_quantumsPerBurst = 5;
protected const float MINDRIPRATE = 500;
/// <summary>
/// </summary>
protected const float m_minimumDripRate = 1500;
// minimum and maximim burst size, ie max number of bytes token can have
protected const float MINBURST = 1500; // can't be less than one MTU or it will block
protected const float MAXBURST = 7500;
/// <summary>Time of the last drip</summary>
protected double m_lastDrip;
@ -109,10 +103,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
get { return m_burst; }
set {
float rate = (value < 0 ? 0 : value);
if (rate < 1.5f * m_minimumDripRate)
rate = 1.5f * m_minimumDripRate;
else if (rate > m_minimumDripRate * m_quantumsPerBurst)
rate = m_minimumDripRate * m_quantumsPerBurst;
if (rate < MINBURST)
rate = MINBURST;
else if (rate > MAXBURST)
rate = MAXBURST;
m_burst = rate;
}
@ -122,8 +116,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{
get {
float rate = RequestedBurst * BurstModifier();
if (rate < m_minimumDripRate)
rate = m_minimumDripRate;
if (rate < MINBURST)
rate = MINBURST;
return (float)rate;
}
}
@ -159,8 +153,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
return rate;
rate *= m_parent.DripRateModifier();
if (rate < m_minimumDripRate)
rate = m_minimumDripRate;
if (rate < MINDRIPRATE)
rate = MINDRIPRATE;
return (float)rate;
}