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/zen/cmds/cache_cmd.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/zen/cmds/cache_cmd.cpp') diff --git a/src/zen/cmds/cache_cmd.cpp b/src/zen/cmds/cache_cmd.cpp index 85dcd7648..2679df10a 100644 --- a/src/zen/cmds/cache_cmd.cpp +++ b/src/zen/cmds/cache_cmd.cpp @@ -538,7 +538,7 @@ CacheGenerateCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** a return Package; }); - WorkerThreadPool WorkerPool(gsl::narrow(Max((std::thread::hardware_concurrency() / 2u), 2u))); + WorkerThreadPool WorkerPool(gsl::narrow(Max((GetHardwareConcurrency() / 2u), 2u))); Latch WorkLatch(1); std::uniform_int_distribution SizeCountDistribution(m_MaxAttachmentCount > 0 ? 0 : 1, -- cgit v1.2.3