From e0da430c424192c24f5089ceb97f37062349e9ef Mon Sep 17 00:00:00 2001 From: Dan Engelbrecht Date: Thu, 14 Sep 2023 03:54:57 -0400 Subject: http and httpsys config options (#401) * Added `--http-threads`, `--httpsys-async-work-threads`, `--httpsys-enable-request-logging` and `--httpsys-enable-async-response` command line options to zenserver * remove unused CreateHttpSysServer --- src/zenhttp/httpsys.cpp | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'src/zenhttp/httpsys.cpp') diff --git a/src/zenhttp/httpsys.cpp b/src/zenhttp/httpsys.cpp index 0b06f0558..2f8e0a898 100644 --- a/src/zenhttp/httpsys.cpp +++ b/src/zenhttp/httpsys.cpp @@ -721,11 +721,13 @@ HttpAsyncWorkRequest::AsyncWorkItem::Execute() \/ \/ \/ */ -HttpSysServer::HttpSysServer(unsigned int ThreadCount, unsigned int AsyncWorkThreadCount) +HttpSysServer::HttpSysServer(const Config& Config) : m_Log(logging::Get("http")) , m_RequestLog(logging::Get("http_requests")) -, m_ThreadPool(ThreadCount) -, m_AsyncWorkPool(AsyncWorkThreadCount, "http_async") +, m_IsRequestLoggingEnabled(Config.IsRequestLoggingEnabled) +, m_IsAsyncResponseEnabled(Config.IsAsyncResponseEnabled) +, m_ThreadPool(Config.ThreadCount != 0 ? Config.ThreadCount : std::thread::hardware_concurrency()) +, m_AsyncWorkPool(Config.AsyncWorkThreadCount != 0 ? Config.AsyncWorkThreadCount : 16, "http_async") { ULONG Result = HttpInitialize(HTTPAPI_VERSION_2, HTTP_INITIALIZE_SERVER, nullptr); @@ -737,7 +739,7 @@ HttpSysServer::HttpSysServer(unsigned int ThreadCount, unsigned int AsyncWorkThr m_IsHttpInitialized = true; m_IsOk = true; - ZEN_INFO("http.sys server started, using {} I/O threads and {} async worker threads", ThreadCount, AsyncWorkThreadCount); + ZEN_INFO("http.sys server started, using {} I/O threads and {} async worker threads", Config.ThreadCount, Config.AsyncWorkThreadCount); } HttpSysServer::~HttpSysServer() @@ -1697,11 +1699,5 @@ HttpSysServer::RegisterService(HttpService& Service) RegisterService(Service.BaseUri(), Service); } -Ref -CreateHttpSysServer(int Concurrency, int BackgroundWorkerThreads) -{ - return Ref(new HttpSysServer(Concurrency, BackgroundWorkerThreads)); -} - } // namespace zen #endif -- cgit v1.2.3