aboutsummaryrefslogtreecommitdiff
path: root/src/zenserver/zenserver.cpp
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2023-10-02 11:29:00 +0200
committerGitHub <[email protected]>2023-10-02 11:29:00 +0200
commit14deb110acac35e96afa72316f6cd871dfe04168 (patch)
tree9206028a2423c01f562d6e3b45b2e2c34947b611 /src/zenserver/zenserver.cpp
parentlightweight gc (#431) (diff)
downloadzen-14deb110acac35e96afa72316f6cd871dfe04168.tar.xz
zen-14deb110acac35e96afa72316f6cd871dfe04168.zip
Limit size of memory cache layer (#423)
- Feature: Limit the size ZenCacheMemoryLayer may use - `--cache-memlayer-targetfootprint` option to set which size (in bytes) it should be limited to, zero to have it unbounded - `--cache-memlayer-maxage` option to set how long (in seconds) cache items should be kept in the memory cache Do more "standard" GC rather than clearing everything. Tries to purge memory on Get/Put on the fly if exceeding limit - not sure if we should have a polling thread instead of adding overhead to Get/Put (however light it may be).
Diffstat (limited to 'src/zenserver/zenserver.cpp')
-rw-r--r--src/zenserver/zenserver.cpp20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/zenserver/zenserver.cpp b/src/zenserver/zenserver.cpp
index e4143dc01..cf9f03d89 100644
--- a/src/zenserver/zenserver.cpp
+++ b/src/zenserver/zenserver.cpp
@@ -383,7 +383,7 @@ public:
}
#endif // ZEN_WITH_COMPUTE_SERVICES
- if (ServerOptions.StructuredCacheEnabled)
+ if (ServerOptions.StructuredCacheConfig.Enabled)
{
InitializeStructuredCache(ServerOptions);
}
@@ -946,13 +946,17 @@ ZenServer::InitializeStructuredCache(const ZenServerOptions& ServerOptions)
using namespace std::literals;
ZEN_INFO("instantiating structured cache service");
- m_CacheStore =
- new ZenCacheStore(m_GcManager,
- ZenCacheStore::Configuration{.BasePath = m_DataRoot / "cache",
- .AllowAutomaticCreationOfNamespaces = true,
- .Logging = {.EnableWriteLog = ServerOptions.StructuredCacheWriteLogEnabled,
- .EnableAccessLog = ServerOptions.StructuredCacheAccessLogEnabled}},
- m_GcManager.GetDiskWriteBlocker());
+ m_CacheStore = new ZenCacheStore(
+ m_GcManager,
+ *m_JobQueue,
+ ZenCacheStore::Configuration{.BasePath = m_DataRoot / "cache",
+ .AllowAutomaticCreationOfNamespaces = true,
+ .MemLayerConfig = {.TargetFootprintBytes = ServerOptions.StructuredCacheConfig.MemTargetFootprintBytes,
+ .TrimIntervalSeconds = ServerOptions.StructuredCacheConfig.MemTrimIntervalSeconds,
+ .MaxAgeSeconds = ServerOptions.StructuredCacheConfig.MemMaxAgeSeconds},
+ .Logging = {.EnableWriteLog = ServerOptions.StructuredCacheConfig.WriteLogEnabled,
+ .EnableAccessLog = ServerOptions.StructuredCacheConfig.AccessLogEnabled}},
+ m_GcManager.GetDiskWriteBlocker());
const ZenUpstreamCacheConfig& UpstreamConfig = ServerOptions.UpstreamCacheConfig;