From c4801320150ea0c492cf343d490a0a339432f060 Mon Sep 17 00:00:00 2001 From: Stefan Boberg Date: Fri, 10 Oct 2025 18:09:53 +0200 Subject: add ability to limit concurrency (#565) effective concurrency in zenserver can be limited via the `--corelimit=` option on the command line. Any value passed in here will be used instead of the return value from `std::thread::hardware_concurrency()` if it is lower. * added --corelimit option to zenserver * made sure thread pools are configured lazily and not during global init * added log output indicating effective and HW concurrency * added change log entry * removed debug logging from ZenEntryPoint::Run() also removed main thread naming on Linux since it makes the output from `top` and similar tools confusing (it shows `main` instead of `zenserver`) --- src/zenserver/main.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/zenserver/main.cpp') diff --git a/src/zenserver/main.cpp b/src/zenserver/main.cpp index a91c95ffb..b4d53ec5f 100644 --- a/src/zenserver/main.cpp +++ b/src/zenserver/main.cpp @@ -93,8 +93,13 @@ ZenEntryPoint::ZenEntryPoint(ZenServerOptions& ServerOptions) : m_ServerOptions( int ZenEntryPoint::Run() { - ZEN_INFO("ZenEntryPoint::Run()"); + // On Linux this has the unfortunate side effect of making `top` and other tools display + // `main` as the program name since threads and processes have a closer relationship + // there. So we don't name the main thread explicitly there. + +#ifndef ZEN_PLATFORM_LINUX zen::SetCurrentThreadName("main"); +#endif #if ZEN_USE_SENTRY SentryIntegration Sentry; @@ -444,6 +449,8 @@ main(int argc, char* argv[]) #endif } + LimitHardwareConcurrency(ServerOptions.CoreLimit); + std::string_view DeleteReason; if (ServerOptions.IsCleanStart) -- cgit v1.2.3