From 4b97a66d2ea8e75bcf8a93b321514e9050a9ecdd Mon Sep 17 00:00:00 2001 From: Stefan Boberg Date: Thu, 12 Oct 2023 10:17:17 +0200 Subject: adjust resource usage for dedicated servers (#466) when dedicated mode is enabled via `--dedicated` or `server.dedicated` then we tune http.sys server settings to be more suitable for a shared server initially we tune two things * the thread pool used to service I/O requests allows a larger number of threads to be created when needed. The minimum thread count is unchanged but in dedicated server mode we double the maximum number of threads allowed * the http.sys request queue length (`HttpServerQueueLengthProperty`) is increased to 50,000 in dedicated mode. The regular default is 1,000 --- src/zenhttp/iothreadpool.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/zenhttp/iothreadpool.cpp') diff --git a/src/zenhttp/iothreadpool.cpp b/src/zenhttp/iothreadpool.cpp index 6087e69ec..da4b42e28 100644 --- a/src/zenhttp/iothreadpool.cpp +++ b/src/zenhttp/iothreadpool.cpp @@ -8,14 +8,19 @@ namespace zen { -WinIoThreadPool::WinIoThreadPool(int InThreadCount) +WinIoThreadPool::WinIoThreadPool(int InThreadCount, int InMaxThreadCount) { - // Thread pool setup + ZEN_ASSERT(InThreadCount); + + if (InMaxThreadCount < InThreadCount) + { + InMaxThreadCount = InThreadCount; + } m_ThreadPool = CreateThreadpool(NULL); SetThreadpoolThreadMinimum(m_ThreadPool, InThreadCount); - SetThreadpoolThreadMaximum(m_ThreadPool, InThreadCount * 2); + SetThreadpoolThreadMaximum(m_ThreadPool, InMaxThreadCount); InitializeThreadpoolEnvironment(&m_CallbackEnvironment); -- cgit v1.2.3