{"record":{"id":"e155aad0bf08170e","repo":"microsoft/garnet","slug":"mutablepercent-must-be-between-10-and-95","errorCode":null,"errorMessage":"MutablePercent must be between 10 and 95","messagePattern":"MutablePercent must be between 10 and 95","errorType":"validation","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"libs/server/Servers/GarnetServerOptions.cs","lineNumber":670,"sourceCode":"        /// </summary>\n        /// <param name=\"loggerFactory\"></param>\n        public void Initialize(ILoggerFactory loggerFactory = null)\n        {\n        }\n\n        /// <summary>\n        /// Get main store settings\n        /// </summary>\n        /// <param name=\"loggerFactory\">Logger factory for debugging and error tracing</param>\n        /// <param name=\"epoch\">Epoch instance used by server</param>\n        /// <param name=\"stateMachineDriver\">Common state machine driver used by Garnet</param>\n        /// <param name=\"logFactory\">Tsavorite Log factory instance</param>\n        /// <returns></returns>\n        /// <exception cref=\"Exception\"></exception>\n        public KVSettings GetSettings(ILoggerFactory loggerFactory, LightEpoch epoch, StateMachineDriver stateMachineDriver, out INamedDeviceFactory logFactory)\n        {\n            if (MutablePercent is < 10 or > 95)\n                throw new Exception(\"MutablePercent must be between 10 and 95\");\n\n            var indexCacheLines = IndexSizeCachelines(\"hash index size\", IndexMemorySize);\n\n            var pageSize = 1L << PageSizeBits();\n            KVSettings kvSettings = new()\n            {\n                IndexSize = indexCacheLines * 64L,\n                PreallocateLog = false,\n                MutableFraction = MutablePercent / 100.0,\n                PageSize = pageSize,\n                Epoch = epoch,\n                StateMachineDriver = stateMachineDriver,\n                MaxInlineKeySize = MaxInlineKeySizeBytes(),\n                MaxInlineValueSize = MaxInlineValueSizeBytes(pageSize),\n                InitialIORecordSize = GetInitialIORecordSizeBytes(),\n                loggerFactory = loggerFactory,\n                logger = loggerFactory?.CreateLogger(\"TsavoriteKV [main]\")\n            };","sourceCodeStart":652,"sourceCodeEnd":688,"githubUrl":"https://github.com/microsoft/garnet/blob/951b0fc6838721f89d102c2bbe1b914e8d39d700/libs/server/Servers/GarnetServerOptions.cs#L652-L688","documentation":"GetSettings rejects a MutablePercent outside [10, 95]. MutablePercent is the fraction of the hybrid log kept mutable (writable) and is passed straight to Tsavorite as MutableFraction; too little mutable space stalls writes and too much defeats the log's immutable-region design. The guard runs before any store allocation, so this fails fast at startup.","triggerScenarios":"Setting --mutable-percent to a value below 10 or above 95 (e.g. --mutable-percent 5 or --mutable-percent 99). Evaluated at GarnetServerOptions.cs:669-670 inside GetSettings.","commonSituations":"Mistuned config copied from guidance for a different engine; attempting to maximize write headroom (99%) or maximize immutable region (5%); typos in JSON/YAML config files.","solutions":["Keep --mutable-percent within [10, 95]; the default is 90.","If you intended extreme write headroom, 95 is the allowed maximum — use that instead of 99.","Validate the value in your config pipeline/deployment template before shipping."],"exampleFix":"# before\ngarnet-server --mutable-percent 5\n\n# after\ngarnet-server --mutable-percent 10   # or omit to use the default 90","handlingStrategy":"validation","validationCode":"if (options.MutablePercent is < 10 or > 95) {\n    throw new ArgumentOutOfRangeException(nameof(options.MutablePercent), \"Must be between 10 and 95\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep MutablePercent in [10, 95]; leave the default (90) unless profiling says otherwise.","Add a config-schema check in CI for numeric ranges."],"tags":["garnet","config","tsavorite","storage","dotnet"],"backgroundTag":null,"analyzedSha":"951b0fc6838721f89d102c2bbe1b914e8d39d700","analyzedAt":"2026-08-13T19:01:32.939Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}