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 )

0.9.0-post-fixes
UbitUmarov 2017-06-13 19:04:18 +01:00
parent 482ff06e13
commit ad43cc6784
2 changed files with 15 additions and 11 deletions

View File

@ -325,6 +325,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// </summary>
public LLImageManager ImageManager { get; private set; }
public JobEngine m_asyncPacketProcess;
private readonly LLUDPServer m_udpServer;
private readonly LLUDPClient m_udpClient;
private readonly UUID m_sessionId;
@ -378,7 +379,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
protected Scene m_scene;
protected string m_firstName;
protected string m_lastName;
protected Thread m_clientThread;
protected Vector3 m_startpos;
protected UUID m_activeGroupID;
protected string m_activeGroupName = String.Empty;
@ -529,7 +529,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
m_prioritizer = new Prioritizer(m_scene);
RegisterLocalPacketHandlers();
string name = string.Format("AsyncInUDP-{0}",m_agentId.ToString());
m_asyncPacketProcess = new JobEngine(name, name, 10000);
IsActive = true;
}
@ -592,6 +593,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (OnConnectionClosed != null)
OnConnectionClosed(this);
m_asyncPacketProcess.Stop();
// Flush all of the packets out of the UDP server for this client
if (m_udpServer != null)
@ -778,12 +780,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
cinfo.AsyncRequests[packet.Type.ToString()]++;
object obj = new AsyncPacketProcess(this, pprocessor.method, packet);
/*
if (pprocessor.InEngine)
m_udpServer.IpahEngine.QueueJob(packet.Type.ToString(), () => ProcessSpecificPacketAsync(obj));
else
Util.FireAndForget(ProcessSpecificPacketAsync, obj, packet.Type.ToString());
*/
m_asyncPacketProcess.QueueJob(packet.Type.ToString(), () => ProcessSpecificPacketAsync(obj));
result = true;
}
else
@ -841,6 +844,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public virtual void Start()
{
m_asyncPacketProcess.Start();
m_scene.AddNewAgent(this, PresenceType.User);
// RefreshGroupMembership();

View File

@ -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
/// threadpool threads.
/// </summary>
public JobEngine IpahEngine { get; protected set; }
// public JobEngine IpahEngine { get; protected set; }
/// <summary>
/// Run queue empty processing within a single persistent thread.
@ -527,7 +527,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{
StartInbound();
StartOutbound();
IpahEngine.Start();
// IpahEngine.Start();
OqrEngine.Start();
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);
base.StopOutbound();
base.StopInbound();
IpahEngine.Stop();
// IpahEngine.Stop();
OqrEngine.Stop();
}
@ -691,12 +691,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
Scene = (Scene)scene;
m_location = new Location(Scene.RegionInfo.RegionHandle);
/*
IpahEngine
= new JobEngine(
string.Format("Incoming Packet Async Handling Engine ({0})", Scene.Name),
"INCOMING PACKET ASYNC HANDLING ENGINE");
*/
OqrEngine
= new JobEngine(
string.Format("Outgoing Queue Refill Engine ({0})", Scene.Name),
@ -781,7 +781,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
MeasuresOfInterest.AverageChangeOverTime,
stat => stat.Value = GetTotalQueuedOutgoingPackets(),
StatVerbosity.Info));
/*
StatsManager.RegisterStat(
new Stat(
"IncomingPacketAsyncRequestsWaiting",
@ -794,7 +794,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
MeasuresOfInterest.None,
stat => stat.Value = IpahEngine.JobsWaiting,
StatVerbosity.Debug));
*/
StatsManager.RegisterStat(
new Stat(
"OQRERequestsWaiting",