diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs index 4058229af3..e75b705eef 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs @@ -57,24 +57,35 @@ namespace OpenSim.Framework.Servers.HttpServer private bool m_running = true; private int slowCount = 0; - private SmartThreadPool m_threadPool = new SmartThreadPool(20000, 12, 2); + private SmartThreadPool m_threadPool; public PollServiceRequestManager(BaseHttpServer pSrv, uint pWorkerThreadCount, int pTimeout) { m_server = pSrv; m_WorkerThreadCount = pWorkerThreadCount; m_workerThreads = new Thread[m_WorkerThreadCount]; + + STPStartInfo startInfo = new STPStartInfo(); + startInfo.IdleTimeout = 30000; + startInfo.MaxWorkerThreads = 15; + startInfo.MinWorkerThreads = 1; + startInfo.ThreadPriority = ThreadPriority.Normal; + startInfo.StartSuspended = true; + startInfo.ThreadPoolName = "PoolService"; + + m_threadPool = new SmartThreadPool(startInfo); } public void Start() { + m_threadPool.Start(); //startup worker threads for (uint i = 0; i < m_WorkerThreadCount; i++) { m_workerThreads[i] = Watchdog.StartThread( PoolWorkerJob, - string.Format("PollServiceWorkerThread{0}:{1}", i, m_server.Port), + string.Format("PollServiceWorkerThread {0}:{1}", i, m_server.Port), ThreadPriority.Normal, false, false, diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index b8b78fa45b..d807e2a028 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -1850,7 +1850,7 @@ namespace OpenSim.Framework STPStartInfo startInfo = new STPStartInfo(); startInfo.ThreadPoolName = "Util"; - startInfo.IdleTimeout = 2000; + startInfo.IdleTimeout = 20000; startInfo.MaxWorkerThreads = maxThreads; startInfo.MinWorkerThreads = minThreads; diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index e1e3d87f89..369e79dec3 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs @@ -113,8 +113,8 @@ namespace OpenSim if (!String.IsNullOrEmpty(asyncCallMethodStr) && Utils.EnumTryParse(asyncCallMethodStr, out asyncCallMethod)) Util.FireAndForgetMethod = asyncCallMethod; - stpMinThreads = startupConfig.GetInt("MinPoolThreads", 15); - stpMaxThreads = startupConfig.GetInt("MaxPoolThreads", 15); + stpMinThreads = startupConfig.GetInt("MinPoolThreads", 2 ); + stpMaxThreads = startupConfig.GetInt("MaxPoolThreads", 25); m_consolePrompt = startupConfig.GetString("ConsolePrompt", @"Region (\R) "); } diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 99e7aba1d0..ac4a877aa6 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -1305,7 +1305,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP PacketsSentCount++; // Put the UDP payload on the wire - AsyncBeginSend(buffer); + //AsyncBeginSend(buffer); + SyncSend(buffer); // Keep track of when this packet was sent out (right now) outgoingPacket.TickCount = Environment.TickCount & Int32.MaxValue; diff --git a/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs b/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs index 881e76876d..1d76c1414b 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs @@ -375,12 +375,28 @@ namespace OpenMetaverse // Synchronous mode waits until the packet callback completes // before starting the receive to fetch another packet - if (!m_asyncPacketHandling) +// if (!m_asyncPacketHandling) AsyncBeginReceive(); } } } + public void SyncSend(UDPPacketBuffer buf) + { + try + { + m_udpSocket.SendTo( + buf.Data, + 0, + buf.DataLength, + SocketFlags.None, + buf.RemoteEndPoint + ); + } + catch (SocketException) { } + catch (ObjectDisposedException) { } + } + public void AsyncBeginSend(UDPPacketBuffer buf) { // if (IsRunningOutbound) diff --git a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs index d27869a64d..6880f56159 100644 --- a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs +++ b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs @@ -320,7 +320,7 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest m_proxyurl = config.Configs["Startup"].GetString("HttpProxy"); m_proxyexcepts = config.Configs["Startup"].GetString("HttpProxyExceptions"); - int maxThreads = 50; + int maxThreads = 15; IConfig httpConfig = config.Configs["HttpRequestModule"]; if (httpConfig != null) @@ -336,12 +336,12 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest STPStartInfo startInfo = new STPStartInfo(); startInfo.IdleTimeout = 20000; startInfo.MaxWorkerThreads = maxThreads; - startInfo.MinWorkerThreads = 5; + startInfo.MinWorkerThreads = 1; startInfo.ThreadPriority = ThreadPriority.BelowNormal; startInfo.StartSuspended = true; + startInfo.ThreadPoolName = "ScriptsHttpReq"; ThreadPool = new SmartThreadPool(startInfo); - ThreadPool.Start(); } } diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODEMeshWorker.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODEMeshWorker.cs index 5030cec783..a6bdaa0727 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/ODEMeshWorker.cs +++ b/OpenSim/Region/Physics/UbitOdePlugin/ODEMeshWorker.cs @@ -100,6 +100,7 @@ namespace OpenSim.Region.Physics.OdePlugin } m_running = true; m_thread = new Thread(DoWork); + m_thread.Name = "OdeMeshWorker"; m_thread.Start(); }