aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2022-06-01 11:03:05 +0200
committerGitHub <[email protected]>2022-06-01 11:03:05 +0200
commitbb7491d3a991d89c4b97c2cb5ce1142709a8da0e (patch)
tree428d0f3e3d25a78305e97542a945cd7f9f4bd6ad
parentMerge pull request #115 from EpicGames/de/block-gc-of-current-write-block (diff)
parentoption description (diff)
downloadzen-bb7491d3a991d89c4b97c2cb5ce1142709a8da0e.tar.xz
zen-bb7491d3a991d89c4b97c2cb5ce1142709a8da0e.zip
Merge pull request #117 from EpicGames/de/configurable-gc-monitor-intervall
Make it possible to configure GC monitoring interval
-rw-r--r--zenserver/config.cpp12
-rw-r--r--zenserver/config.h9
-rw-r--r--zenserver/zenserver.cpp1
3 files changed, 16 insertions, 6 deletions
diff --git a/zenserver/config.cpp b/zenserver/config.cpp
index be91ae4f8..c534865dc 100644
--- a/zenserver/config.cpp
+++ b/zenserver/config.cpp
@@ -478,6 +478,13 @@ ParseCliOptions(int argc, char* argv[], ZenServerOptions& ServerOptions)
"Size of gc disk reserve in bytes.",
cxxopts::value<uint64_t>(ServerOptions.GcConfig.DiskReserveSize)->default_value("268435456"),
"");
+
+ options.add_option("gc",
+ "",
+ "gc-monitor-interval-seconds",
+ "Garbage collection monitoring interval in seconds.",
+ cxxopts::value<int32_t>(ServerOptions.GcConfig.MonitorIntervalSeconds)->default_value("30"),
+ "");
try
{
auto result = options.parse(argc, argv);
@@ -770,8 +777,9 @@ ParseConfigFile(const std::filesystem::path& Path, ZenServerOptions& ServerOptio
if (sol::optional<sol::table> GcConfig = lua["gc"])
{
- ServerOptions.GcConfig.IntervalSeconds = GcConfig.value().get_or("intervalseconds", 0);
- ServerOptions.GcConfig.DiskReserveSize = GcConfig.value().get_or("diskreservesize", uint64_t(1u << 28));
+ ServerOptions.GcConfig.MonitorIntervalSeconds = GcConfig.value().get_or("monitorintervalseconds", 30);
+ ServerOptions.GcConfig.IntervalSeconds = GcConfig.value().get_or("intervalseconds", 0);
+ ServerOptions.GcConfig.DiskReserveSize = GcConfig.value().get_or("diskreservesize", uint64_t(1u << 28));
if (sol::optional<sol::table> CacheGcConfig = GcConfig.value()["cache"])
{
diff --git a/zenserver/config.h b/zenserver/config.h
index 49f039d8d..a07bba9a4 100644
--- a/zenserver/config.h
+++ b/zenserver/config.h
@@ -96,10 +96,11 @@ struct ZenGcConfig
{
ZenCasEvictionPolicy Cas;
ZenCacheEvictionPolicy Cache;
- int32_t IntervalSeconds = 0;
- bool CollectSmallObjects = true;
- bool Enabled = true;
- uint64_t DiskReserveSize = 1ul << 28;
+ int32_t MonitorIntervalSeconds = 30;
+ int32_t IntervalSeconds = 0;
+ bool CollectSmallObjects = true;
+ bool Enabled = true;
+ uint64_t DiskReserveSize = 1ul << 28;
};
struct ZenServerOptions
diff --git a/zenserver/zenserver.cpp b/zenserver/zenserver.cpp
index a924d9c81..4db69c265 100644
--- a/zenserver/zenserver.cpp
+++ b/zenserver/zenserver.cpp
@@ -364,6 +364,7 @@ public:
ZEN_INFO("initializing GC, enabled '{}', interval {}s", ServerOptions.GcConfig.Enabled, ServerOptions.GcConfig.IntervalSeconds);
zen::GcSchedulerConfig GcConfig{
.RootDirectory = m_DataRoot / "gc",
+ .MonitorInterval = std::chrono::seconds(ServerOptions.GcConfig.MonitorIntervalSeconds),
.Interval = std::chrono::seconds(ServerOptions.GcConfig.IntervalSeconds),
.MaxCacheDuration = std::chrono::seconds(ServerOptions.GcConfig.Cache.MaxDurationSeconds),
.CollectSmallObjects = ServerOptions.GcConfig.CollectSmallObjects,