aboutsummaryrefslogtreecommitdiff
path: root/src/zenserver/config.h
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/config.h
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/config.h')
-rw-r--r--src/zenserver/config.h72
1 files changed, 40 insertions, 32 deletions
diff --git a/src/zenserver/config.h b/src/zenserver/config.h
index bb6e20bb6..924375a19 100644
--- a/src/zenserver/config.h
+++ b/src/zenserver/config.h
@@ -116,40 +116,48 @@ struct ZenObjectStoreConfig
std::vector<BucketConfig> Buckets;
};
+struct ZenStructuredCacheConfig
+{
+ bool Enabled = true;
+ bool WriteLogEnabled = false;
+ bool AccessLogEnabled = false;
+ uint64_t MemTargetFootprintBytes = 512 * 1024 * 1024;
+ uint64_t MemTrimIntervalSeconds = 60;
+ uint64_t MemMaxAgeSeconds = gsl::narrow<uint64_t>(std::chrono::seconds(std::chrono::days(1)).count());
+};
+
struct ZenServerOptions
{
- ZenUpstreamCacheConfig UpstreamCacheConfig;
- ZenGcConfig GcConfig;
- ZenAuthConfig AuthConfig;
- ZenObjectStoreConfig ObjectStoreConfig;
- zen::HttpServerConfig HttpServerConfig;
- std::filesystem::path DataDir; // Root directory for state (used for testing)
- std::filesystem::path ContentDir; // Root directory for serving frontend content (experimental)
- std::filesystem::path AbsLogFile; // Absolute path to main log file
- std::filesystem::path ConfigFile; // Path to Lua config file
- std::string ChildId; // Id assigned by parent process (used for lifetime management)
- std::string LogId; // Id for tagging log output
- std::string EncryptionKey; // 256 bit AES encryption key
- std::string EncryptionIV; // 128 bit AES initialization vector
- int BasePort = 1337; // Service listen port (used for both UDP and TCP)
- int OwnerPid = 0; // Parent process id (zero for standalone)
- int WebSocketPort = 0; // Web socket port (Zero = disabled)
- int WebSocketThreads = 0;
- bool InstallService = false; // Flag used to initiate service install (temporary)
- bool UninstallService = false; // Flag used to initiate service uninstall (temporary)
- bool IsDebug = false;
- bool IsTest = false;
- bool IsDedicated = false; // Indicates a dedicated/shared instance, with larger resource requirements
- bool StructuredCacheEnabled = true;
- bool StructuredCacheWriteLogEnabled = false;
- bool StructuredCacheAccessLogEnabled = false;
- bool ExecServiceEnabled = true;
- bool ComputeServiceEnabled = true;
- bool ShouldCrash = false; // Option for testing crash handling
- bool IsFirstRun = false;
- bool NoSentry = false;
- bool SentryAllowPII = false; // Allow personally identifiable information in sentry crash reports
- bool ObjectStoreEnabled = false;
+ ZenUpstreamCacheConfig UpstreamCacheConfig;
+ ZenGcConfig GcConfig;
+ ZenAuthConfig AuthConfig;
+ ZenObjectStoreConfig ObjectStoreConfig;
+ zen::HttpServerConfig HttpServerConfig;
+ ZenStructuredCacheConfig StructuredCacheConfig;
+ std::filesystem::path DataDir; // Root directory for state (used for testing)
+ std::filesystem::path ContentDir; // Root directory for serving frontend content (experimental)
+ std::filesystem::path AbsLogFile; // Absolute path to main log file
+ std::filesystem::path ConfigFile; // Path to Lua config file
+ std::string ChildId; // Id assigned by parent process (used for lifetime management)
+ std::string LogId; // Id for tagging log output
+ std::string EncryptionKey; // 256 bit AES encryption key
+ std::string EncryptionIV; // 128 bit AES initialization vector
+ int BasePort = 1337; // Service listen port (used for both UDP and TCP)
+ int OwnerPid = 0; // Parent process id (zero for standalone)
+ int WebSocketPort = 0; // Web socket port (Zero = disabled)
+ int WebSocketThreads = 0;
+ bool InstallService = false; // Flag used to initiate service install (temporary)
+ bool UninstallService = false; // Flag used to initiate service uninstall (temporary)
+ bool IsDebug = false;
+ bool IsTest = false;
+ bool IsDedicated = false; // Indicates a dedicated/shared instance, with larger resource requirements
+ bool ExecServiceEnabled = true;
+ bool ComputeServiceEnabled = true;
+ bool ShouldCrash = false; // Option for testing crash handling
+ bool IsFirstRun = false;
+ bool NoSentry = false;
+ bool SentryAllowPII = false; // Allow personally identifiable information in sentry crash reports
+ bool ObjectStoreEnabled = false;
#if ZEN_WITH_TRACE
std::string TraceHost; // Host name or IP address to send trace data to
std::string TraceFile; // Path of a file to write a trace