From 53bf479bab05e689b1403a27a175bedad379ea6d Mon Sep 17 00:00:00 2001
From: John Hurliman
Date: Fri, 23 Oct 2009 01:11:40 -0700
Subject: Commented out noisy debugging about resent packets (normal) and
agents setting throttles (normal)
---
OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
(limited to 'OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs')
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs
index a9bc7d2..460938e 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs
@@ -304,8 +304,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
int total = resend + land + wind + cloud + task + texture + asset + 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);
+ //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);
// Update the token buckets with new throttle values
TokenBucket bucket;
--
cgit v1.1
From ac0acb02962c37f870dc38a356e1530803f699e8 Mon Sep 17 00:00:00 2001
From: John Hurliman
Date: Fri, 23 Oct 2009 01:33:05 -0700
Subject: * Changed the max RTO value to 60 seconds to comply with RFC 2988 *
Implemented section 5.5, exponential backoff of the RTO after a resend
---
OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs')
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs
index 460938e..d2cd6d9 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs
@@ -500,7 +500,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
RTO = (int)(SRTT + Math.Max(m_udpServer.TickCountResolution, K * RTTVAR));
// Clamp the retransmission timeout to manageable values
- RTO = Utils.Clamp(RTO, 3000, 10000);
+ RTO = Utils.Clamp(RTO, 3000, 60000);
//m_log.Debug("[LLUDPCLIENT]: Setting agent " + this.Agent.FullName + "'s RTO to " + RTO + "ms with an RTTVAR of " +
// RTTVAR + " based on new RTT of " + r + "ms");
--
cgit v1.1
From 730930955a7edc0bfa69ff1cac93acd024cf8d24 Mon Sep 17 00:00:00 2001
From: John Hurliman
Date: Sun, 25 Oct 2009 00:40:21 -0700
Subject: Changing Scene.ForEachClient to use the synchronous for loop instead
of Parallel. This is quite possibly the source of some deadlocking, and at
the very least the synchronous version gives better stack traces * Lock the
LLUDPClient RTO math * Add a helper function for backing off the RTO, and
follow the optional advice in RFC 2988 to clear existing SRTT and RTTVAR
values during a backoff
* Removing the unused PrimitiveBaseShape.SculptImage parameter * Improved performance of SceneObjectPart instantiation * ZeroMesher now drops SculptData bytes like Meshmerizer, to allow the texture data to be GCed * Improved typecasting speed in MySQLLegacyRegionData.BuildShape()
* Improved the instantiation of PrimitiveBaseShape
---
.../Region/ClientStack/LindenUDP/LLUDPClient.cs | 54 ++++++++++++++++------
1 file changed, 40 insertions(+), 14 deletions(-)
(limited to 'OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs')
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs
index d2cd6d9..0948e1c 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs
@@ -144,6 +144,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
private readonly OutgoingPacket[] m_nextPackets = new OutgoingPacket[THROTTLE_CATEGORY_COUNT];
/// A reference to the LLUDPServer that is managing this client
private readonly LLUDPServer m_udpServer;
+ /// Locks access to the variables used while calculating round-trip
+ /// packet times and the retransmission timeout
+ private readonly object m_roundTripCalcLock = new object();
///
/// Default constructor
@@ -484,29 +487,52 @@ namespace OpenSim.Region.ClientStack.LindenUDP
const float BETA = 0.25f;
const float K = 4.0f;
- if (RTTVAR == 0.0f)
+ lock (m_roundTripCalcLock)
{
- // First RTT measurement
- SRTT = r;
- RTTVAR = r * 0.5f;
- }
- else
- {
- // Subsequence RTT measurement
- RTTVAR = (1.0f - BETA) * RTTVAR + BETA * Math.Abs(SRTT - r);
- SRTT = (1.0f - ALPHA) * SRTT + ALPHA * r;
- }
+ if (RTTVAR == 0.0f)
+ {
+ // First RTT measurement
+ SRTT = r;
+ RTTVAR = r * 0.5f;
+ }
+ else
+ {
+ // Subsequence RTT measurement
+ RTTVAR = (1.0f - BETA) * RTTVAR + BETA * Math.Abs(SRTT - r);
+ SRTT = (1.0f - ALPHA) * SRTT + ALPHA * r;
+ }
- RTO = (int)(SRTT + Math.Max(m_udpServer.TickCountResolution, K * RTTVAR));
+ int rto = (int)(SRTT + Math.Max(m_udpServer.TickCountResolution, K * RTTVAR));
- // Clamp the retransmission timeout to manageable values
- RTO = Utils.Clamp(RTO, 3000, 60000);
+ // Clamp the retransmission timeout to manageable values
+ rto = Utils.Clamp(RTO, 3000, 60000);
+
+ RTO = rto;
+ }
//m_log.Debug("[LLUDPCLIENT]: Setting agent " + this.Agent.FullName + "'s RTO to " + RTO + "ms with an RTTVAR of " +
// RTTVAR + " based on new RTT of " + r + "ms");
}
///
+ /// Exponential backoff of the retransmission timeout, per section 5.5
+ /// of RFC 2988
+ ///
+ public void BackoffRTO()
+ {
+ lock (m_roundTripCalcLock)
+ {
+ // Reset SRTT and RTTVAR, we assume they are bogus since things
+ // didn't work out and we're backing off the timeout
+ SRTT = 0.0f;
+ RTTVAR = 0.0f;
+
+ // Double the retransmission timeout
+ RTO = Math.Min(RTO * 2, 60000);
+ }
+ }
+
+ ///
/// Does an early check to see if this queue empty callback is already
/// running, then asynchronously firing the event
///
--
cgit v1.1
From 2222172afaa97a8550c08c32cab3474d37fcf984 Mon Sep 17 00:00:00 2001
From: John Hurliman
Date: Mon, 26 Oct 2009 11:28:02 -0700
Subject: Removed an unnecessary lock in LLUDPClient.UpdateRTO() and
LLUDPClient.BackoffRTO()
---
.../Region/ClientStack/LindenUDP/LLUDPClient.cs | 51 +++++++++-------------
1 file changed, 21 insertions(+), 30 deletions(-)
(limited to 'OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs')
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs
index 0948e1c..a823f3b 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs
@@ -144,9 +144,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
private readonly OutgoingPacket[] m_nextPackets = new OutgoingPacket[THROTTLE_CATEGORY_COUNT];
/// A reference to the LLUDPServer that is managing this client
private readonly LLUDPServer m_udpServer;
- /// Locks access to the variables used while calculating round-trip
- /// packet times and the retransmission timeout
- private readonly object m_roundTripCalcLock = new object();
///
/// Default constructor
@@ -487,28 +484,25 @@ namespace OpenSim.Region.ClientStack.LindenUDP
const float BETA = 0.25f;
const float K = 4.0f;
- lock (m_roundTripCalcLock)
+ if (RTTVAR == 0.0f)
{
- if (RTTVAR == 0.0f)
- {
- // First RTT measurement
- SRTT = r;
- RTTVAR = r * 0.5f;
- }
- else
- {
- // Subsequence RTT measurement
- RTTVAR = (1.0f - BETA) * RTTVAR + BETA * Math.Abs(SRTT - r);
- SRTT = (1.0f - ALPHA) * SRTT + ALPHA * r;
- }
+ // First RTT measurement
+ SRTT = r;
+ RTTVAR = r * 0.5f;
+ }
+ else
+ {
+ // Subsequence RTT measurement
+ RTTVAR = (1.0f - BETA) * RTTVAR + BETA * Math.Abs(SRTT - r);
+ SRTT = (1.0f - ALPHA) * SRTT + ALPHA * r;
+ }
- int rto = (int)(SRTT + Math.Max(m_udpServer.TickCountResolution, K * RTTVAR));
+ int rto = (int)(SRTT + Math.Max(m_udpServer.TickCountResolution, K * RTTVAR));
- // Clamp the retransmission timeout to manageable values
- rto = Utils.Clamp(RTO, 3000, 60000);
+ // Clamp the retransmission timeout to manageable values
+ rto = Utils.Clamp(RTO, 3000, 60000);
- RTO = rto;
- }
+ RTO = rto;
//m_log.Debug("[LLUDPCLIENT]: Setting agent " + this.Agent.FullName + "'s RTO to " + RTO + "ms with an RTTVAR of " +
// RTTVAR + " based on new RTT of " + r + "ms");
@@ -520,16 +514,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
///
public void BackoffRTO()
{
- lock (m_roundTripCalcLock)
- {
- // Reset SRTT and RTTVAR, we assume they are bogus since things
- // didn't work out and we're backing off the timeout
- SRTT = 0.0f;
- RTTVAR = 0.0f;
+ // Reset SRTT and RTTVAR, we assume they are bogus since things
+ // didn't work out and we're backing off the timeout
+ SRTT = 0.0f;
+ RTTVAR = 0.0f;
- // Double the retransmission timeout
- RTO = Math.Min(RTO * 2, 60000);
- }
+ // Double the retransmission timeout
+ RTO = Math.Min(RTO * 2, 60000);
}
///
--
cgit v1.1
From c75d4156487b35aac47aa6818144862a99bb841c Mon Sep 17 00:00:00 2001
From: John Hurliman
Date: Tue, 27 Oct 2009 00:26:56 -0700
Subject: * Converts ClientManager.ForEach() (and as a result,
Scene.ForEachClient()) to use a non-blocking parallel method when operating
in async mode * Minor code readability cleanup
---
OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs')
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs
index a823f3b..84a4959 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs
@@ -372,7 +372,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
OpenSim.Framework.LocklessQueue queue = m_packetOutboxes[category];
TokenBucket bucket = m_throttleCategories[category];
- if (m_throttleCategories[category].RemoveTokens(packet.Buffer.DataLength))
+ if (bucket.RemoveTokens(packet.Buffer.DataLength))
{
// Enough tokens were removed from the bucket, the packet will not be queued
return false;
--
cgit v1.1