change llclient async udp packets processing. Removed the shared Jobengine that made only one thread do some packets for all users, and removed the FireAndForget, so each user could issue a unlimited number of threads. Added a new JobEngine per client, so each gets at most one thread,and that thread can be released if iddle (for 5 seconds )
parent
482ff06e13
commit
ad43cc6784
|
@ -325,6 +325,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public LLImageManager ImageManager { get; private set; }
|
public LLImageManager ImageManager { get; private set; }
|
||||||
|
|
||||||
|
public JobEngine m_asyncPacketProcess;
|
||||||
private readonly LLUDPServer m_udpServer;
|
private readonly LLUDPServer m_udpServer;
|
||||||
private readonly LLUDPClient m_udpClient;
|
private readonly LLUDPClient m_udpClient;
|
||||||
private readonly UUID m_sessionId;
|
private readonly UUID m_sessionId;
|
||||||
|
@ -378,7 +379,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
protected Scene m_scene;
|
protected Scene m_scene;
|
||||||
protected string m_firstName;
|
protected string m_firstName;
|
||||||
protected string m_lastName;
|
protected string m_lastName;
|
||||||
protected Thread m_clientThread;
|
|
||||||
protected Vector3 m_startpos;
|
protected Vector3 m_startpos;
|
||||||
protected UUID m_activeGroupID;
|
protected UUID m_activeGroupID;
|
||||||
protected string m_activeGroupName = String.Empty;
|
protected string m_activeGroupName = String.Empty;
|
||||||
|
@ -529,7 +529,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
m_prioritizer = new Prioritizer(m_scene);
|
m_prioritizer = new Prioritizer(m_scene);
|
||||||
|
|
||||||
RegisterLocalPacketHandlers();
|
RegisterLocalPacketHandlers();
|
||||||
|
string name = string.Format("AsyncInUDP-{0}",m_agentId.ToString());
|
||||||
|
m_asyncPacketProcess = new JobEngine(name, name, 10000);
|
||||||
IsActive = true;
|
IsActive = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -592,6 +593,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
if (OnConnectionClosed != null)
|
if (OnConnectionClosed != null)
|
||||||
OnConnectionClosed(this);
|
OnConnectionClosed(this);
|
||||||
|
|
||||||
|
m_asyncPacketProcess.Stop();
|
||||||
|
|
||||||
// Flush all of the packets out of the UDP server for this client
|
// Flush all of the packets out of the UDP server for this client
|
||||||
if (m_udpServer != null)
|
if (m_udpServer != null)
|
||||||
|
@ -778,12 +780,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
cinfo.AsyncRequests[packet.Type.ToString()]++;
|
cinfo.AsyncRequests[packet.Type.ToString()]++;
|
||||||
|
|
||||||
object obj = new AsyncPacketProcess(this, pprocessor.method, packet);
|
object obj = new AsyncPacketProcess(this, pprocessor.method, packet);
|
||||||
|
/*
|
||||||
if (pprocessor.InEngine)
|
if (pprocessor.InEngine)
|
||||||
m_udpServer.IpahEngine.QueueJob(packet.Type.ToString(), () => ProcessSpecificPacketAsync(obj));
|
m_udpServer.IpahEngine.QueueJob(packet.Type.ToString(), () => ProcessSpecificPacketAsync(obj));
|
||||||
else
|
else
|
||||||
Util.FireAndForget(ProcessSpecificPacketAsync, obj, packet.Type.ToString());
|
Util.FireAndForget(ProcessSpecificPacketAsync, obj, packet.Type.ToString());
|
||||||
|
*/
|
||||||
|
m_asyncPacketProcess.QueueJob(packet.Type.ToString(), () => ProcessSpecificPacketAsync(obj));
|
||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -841,6 +844,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
|
|
||||||
public virtual void Start()
|
public virtual void Start()
|
||||||
{
|
{
|
||||||
|
m_asyncPacketProcess.Start();
|
||||||
m_scene.AddNewAgent(this, PresenceType.User);
|
m_scene.AddNewAgent(this, PresenceType.User);
|
||||||
|
|
||||||
// RefreshGroupMembership();
|
// RefreshGroupMembership();
|
||||||
|
|
|
@ -414,7 +414,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
/// Queue some low priority but potentially high volume async requests so that they don't overwhelm available
|
/// Queue some low priority but potentially high volume async requests so that they don't overwhelm available
|
||||||
/// threadpool threads.
|
/// threadpool threads.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public JobEngine IpahEngine { get; protected set; }
|
// public JobEngine IpahEngine { get; protected set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Run queue empty processing within a single persistent thread.
|
/// Run queue empty processing within a single persistent thread.
|
||||||
|
@ -527,7 +527,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
{
|
{
|
||||||
StartInbound();
|
StartInbound();
|
||||||
StartOutbound();
|
StartOutbound();
|
||||||
IpahEngine.Start();
|
// IpahEngine.Start();
|
||||||
OqrEngine.Start();
|
OqrEngine.Start();
|
||||||
|
|
||||||
m_elapsedMSSinceLastStatReport = Environment.TickCount;
|
m_elapsedMSSinceLastStatReport = Environment.TickCount;
|
||||||
|
@ -572,7 +572,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
m_log.Info("[LLUDPSERVER]: Shutting down the LLUDP server for " + Scene.Name);
|
m_log.Info("[LLUDPSERVER]: Shutting down the LLUDP server for " + Scene.Name);
|
||||||
base.StopOutbound();
|
base.StopOutbound();
|
||||||
base.StopInbound();
|
base.StopInbound();
|
||||||
IpahEngine.Stop();
|
// IpahEngine.Stop();
|
||||||
OqrEngine.Stop();
|
OqrEngine.Stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -691,12 +691,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
|
|
||||||
Scene = (Scene)scene;
|
Scene = (Scene)scene;
|
||||||
m_location = new Location(Scene.RegionInfo.RegionHandle);
|
m_location = new Location(Scene.RegionInfo.RegionHandle);
|
||||||
|
/*
|
||||||
IpahEngine
|
IpahEngine
|
||||||
= new JobEngine(
|
= new JobEngine(
|
||||||
string.Format("Incoming Packet Async Handling Engine ({0})", Scene.Name),
|
string.Format("Incoming Packet Async Handling Engine ({0})", Scene.Name),
|
||||||
"INCOMING PACKET ASYNC HANDLING ENGINE");
|
"INCOMING PACKET ASYNC HANDLING ENGINE");
|
||||||
|
*/
|
||||||
OqrEngine
|
OqrEngine
|
||||||
= new JobEngine(
|
= new JobEngine(
|
||||||
string.Format("Outgoing Queue Refill Engine ({0})", Scene.Name),
|
string.Format("Outgoing Queue Refill Engine ({0})", Scene.Name),
|
||||||
|
@ -781,7 +781,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
MeasuresOfInterest.AverageChangeOverTime,
|
MeasuresOfInterest.AverageChangeOverTime,
|
||||||
stat => stat.Value = GetTotalQueuedOutgoingPackets(),
|
stat => stat.Value = GetTotalQueuedOutgoingPackets(),
|
||||||
StatVerbosity.Info));
|
StatVerbosity.Info));
|
||||||
|
/*
|
||||||
StatsManager.RegisterStat(
|
StatsManager.RegisterStat(
|
||||||
new Stat(
|
new Stat(
|
||||||
"IncomingPacketAsyncRequestsWaiting",
|
"IncomingPacketAsyncRequestsWaiting",
|
||||||
|
@ -794,7 +794,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
MeasuresOfInterest.None,
|
MeasuresOfInterest.None,
|
||||||
stat => stat.Value = IpahEngine.JobsWaiting,
|
stat => stat.Value = IpahEngine.JobsWaiting,
|
||||||
StatVerbosity.Debug));
|
StatVerbosity.Debug));
|
||||||
|
*/
|
||||||
StatsManager.RegisterStat(
|
StatsManager.RegisterStat(
|
||||||
new Stat(
|
new Stat(
|
||||||
"OQRERequestsWaiting",
|
"OQRERequestsWaiting",
|
||||||
|
|
Loading…
Reference in New Issue