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/zenstore/workspaces.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/zenstore/workspaces.cpp') diff --git a/src/zenstore/workspaces.cpp b/src/zenstore/workspaces.cpp index 4e7bd79a3..c2391588c 100644 --- a/src/zenstore/workspaces.cpp +++ b/src/zenstore/workspaces.cpp @@ -1356,7 +1356,7 @@ TEST_CASE("workspaces.scanfolder") { using namespace std::literals; - WorkerThreadPool WorkerPool(std::thread::hardware_concurrency()); + WorkerThreadPool WorkerPool(GetHardwareConcurrency()); ScopedTemporaryDirectory TempDir; std::filesystem::path RootPath = TempDir.Path(); @@ -1381,7 +1381,7 @@ TEST_CASE("workspace.share.paths") { using namespace std::literals; - WorkerThreadPool WorkerPool(std::thread::hardware_concurrency()); + WorkerThreadPool WorkerPool(GetHardwareConcurrency()); ScopedTemporaryDirectory TempDir; std::filesystem::path RootPath = TempDir.Path() / "workspace"; @@ -1409,7 +1409,7 @@ TEST_CASE("workspace.share.basic") { using namespace std::literals; - WorkerThreadPool WorkerPool(std::thread::hardware_concurrency()); + WorkerThreadPool WorkerPool(GetHardwareConcurrency()); ScopedTemporaryDirectory TempDir; std::filesystem::path RootPath = TempDir.Path() / "workspace"; @@ -1503,7 +1503,7 @@ TEST_CASE("workspace.share.alias") { using namespace std::literals; - WorkerThreadPool WorkerPool(std::thread::hardware_concurrency()); + WorkerThreadPool WorkerPool(GetHardwareConcurrency()); ScopedTemporaryDirectory TempDir; std::filesystem::path RootPath = TempDir.Path() / "workspace"; -- cgit v1.2.3