aboutsummaryrefslogtreecommitdiff
path: root/src/zenserver
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2025-10-10 15:34:30 +0200
committerStefan Boberg <[email protected]>2025-10-10 15:34:30 +0200
commit07e2df59856ef71bcac54d47c9d4d35b6f9ba7cd (patch)
tree53b8f7e17e1f57af409e703f0a2ffcb7f90378ab /src/zenserver
parentmade server count dynamic via `--count` argument (diff)
downloadzen-07e2df59856ef71bcac54d47c9d4d35b6f9ba7cd.tar.xz
zen-07e2df59856ef71bcac54d47c9d4d35b6f9ba7cd.zip
added --corelimit option to zenserver
Diffstat (limited to 'src/zenserver')
-rw-r--r--src/zenserver/cache/httpstructuredcache.cpp2
-rw-r--r--src/zenserver/config.cpp1
-rw-r--r--src/zenserver/config.h1
-rw-r--r--src/zenserver/main.cpp2
4 files changed, 5 insertions, 1 deletions
diff --git a/src/zenserver/cache/httpstructuredcache.cpp b/src/zenserver/cache/httpstructuredcache.cpp
index dd5bf05cb..9f87c208c 100644
--- a/src/zenserver/cache/httpstructuredcache.cpp
+++ b/src/zenserver/cache/httpstructuredcache.cpp
@@ -423,7 +423,7 @@ HttpStructuredCacheService::HandleRequest(HttpServerRequest& Request)
std::string RecordPath = UrlDecode(Params.GetValue("path"));
- uint32_t ThreadCount = std::thread::hardware_concurrency();
+ uint32_t ThreadCount = GetHardwareConcurrency();
if (auto Param = Params.GetValue("thread_count"); Param.empty() == false)
{
if (auto Value = ParseInt<uint64_t>(Param))
diff --git a/src/zenserver/config.cpp b/src/zenserver/config.cpp
index 0cf5a9ca3..697d44214 100644
--- a/src/zenserver/config.cpp
+++ b/src/zenserver/config.cpp
@@ -817,6 +817,7 @@ ParseCliOptions(int argc, char* argv[], ZenServerOptions& ServerOptions)
options.add_options()("malloc",
"Configure memory allocator subsystem",
cxxopts::value(ServerOptions.MemoryOptions)->default_value("mimalloc"));
+ options.add_options()("corelimit", "Limit concurrency", cxxopts::value(ServerOptions.CoreLimit));
// clang-format off
options.add_options("logging")
diff --git a/src/zenserver/config.h b/src/zenserver/config.h
index 8380e72e7..3f7cb149a 100644
--- a/src/zenserver/config.h
+++ b/src/zenserver/config.h
@@ -207,6 +207,7 @@ struct ZenServerOptions
bool ObjectStoreEnabled = false;
bool NoConsoleOutput = false; // Control default use of stdout for diagnostics
bool QuietConsole = false; // Configure console logger output to level WARN
+ int CoreLimit = 0; // If set, hardware concurrency queries are capped at this number
std::string Loggers[zen::logging::level::LogLevelCount];
std::string ScrubOptions;
#if ZEN_WITH_TRACE
diff --git a/src/zenserver/main.cpp b/src/zenserver/main.cpp
index a91c95ffb..bd4f994b8 100644
--- a/src/zenserver/main.cpp
+++ b/src/zenserver/main.cpp
@@ -444,6 +444,8 @@ main(int argc, char* argv[])
#endif
}
+ LimitHardwareConcurrency(ServerOptions.CoreLimit);
+
std::string_view DeleteReason;
if (ServerOptions.IsCleanStart)