Options Reference: WalMaxRetainedBytes to WalReplaySliceBudget
This page is part of the documentation for Orleans.Lattice 10.5.0 (release line 10.5), built 2026-12-05. It is also published as markdown, with every table and list, at options-reference-5.md, and llms.txt lists every page.
Part of Options Reference, in Configuration.
WalMaxRetainedBytes
Optional advisory ceiling on a tree's WAL bytes (default: null, disabled). Despite the name it bounds on-disk occupancy, not live payload: when set, each ILatticeWalGc.RunOnceAsync pass samples the WAL's physical size - every byte it occupies, including dead bytes trimmed but not yet reclaimed by compaction, falling back per partition to the retained figure when a provider cannot report physical size - before and after its safe trim; if the pre-trim total exceeds the ceiling the policy schedules a byte-pressure trim (surfaced as the orleans.lattice.storage.policy.trim_triggered counter and LatticeWalGcReport.BytePressureTriggered), trimming toward WalMaxRetainedBytes * WalBytePressureReclaimTarget. The policy is advisory only: the GC never trims past the safe frontier (the slowest consumer's cursor, or the WalRetention window where set, overruled where available by the durable materialiser offset floor, intersected with the causal-stable frontier and held below the blocked floor) to honour it, so a tree can remain over the ceiling - LatticeWalGcReport.BytePressureOverThreshold and the orleans.lattice.storage.policy.over_threshold gauge report that occupancy, not its cause. A lagging consumer pinning the frontier is one cause, but occupancy counts dead bytes awaiting compaction, so a tree that reclaimed everything it was entitled to sets the flag with nothing pinning it; read LatticeWalGcReport.CursorFloorState and LatticeWalGcReport.RetainedBacklog to tell those apart. null disables the policy. See WAL and Tree Storage.
This option can be changed freely at any time. The new value takes effect on the next GC tick.
Size it above LatticeOptions.WalMaxRetainedBytesWorkingSetMultiple (2) times the largest tree's logical working set. A log-structured provider reclaims dead bytes only by rewriting a segment once they reach its compaction threshold (half the file at the file provider's default ratio), so a healthy tree's steady-state occupancy is about twice its live set. A ceiling below that multiple is unsatisfiable by construction, and with the default WalBytePressureReclaimTarget of 0.8 its disarm point sits below the tree's natural floor, so the advisory alarm arms and never clears. Because the working set grows, nothing validates the rule at startup; every pass evaluates it against the working set it just measured and reports a breach on orleans.lattice.wal.gc.ceiling_unsatisfiable, which is zero-primed per tree.
A per-tree override can be set at runtime, with no silo restart (issue #3333). The silo-wide value above is the default for every tree; an individual tree can pin its own ceiling through the tree-admin facade (lattice_treeadmin_tree_set_config with applyWalMaxRetainedBytes: true, or ILatticeTreeAdmin.SetTreeConfigAsync with TreeConfigurationUpdate.ApplyWalMaxRetainedBytes). The override is persisted on the tree's registry entry and re-read on every GC pass, so it takes effect on that tree's next pass rather than at the next silo start; a null value clears the override and restores the silo-wide default. This matters because the silo-wide value is usually sourced from environment or file configuration that a running host cannot change, so before this existed, correcting a ceiling that had become too small for a grown tree cost a restart - and a restart is exactly what an operator wants to avoid on a host whose WAL is already under pressure. The ceiling is advisory in both forms: an override can never cause the GC to trim past the safe frontier, so lowering one cannot lose data, it only moves the point at which byte-pressure trimming and the cadence floor engage.
This default was re-examined during the bounded-cold-start work and deliberately left disabled. It is a capacity quota rather than a retention mechanism: a correct value is a fraction of the volume the WAL lives on, which the library cannot know, and any value shipped as a default would be wrong for most deployments in one direction or the other. Enabling it adds no provider call while the default-on durability hold (WalDurabilityHoldCeilingBytes) is in force, because every collection pass already samples each WAL partition's byte size, before and after its trim, to bound that hold; only where the hold is disabled does enabling it add that per-partition probe to every pass.
Leaving it off does not blind an operator. orleans.lattice.wal.gc.passes is emitted unconditionally with a reclaimed | blocked | no_partitions | no_consumer | idle | over_ceiling | stranded | unclassified | failed outcome tag, and reclaimed volume is visible through orleans.lattice.wal.entries_trimmed; every pass still samples the WAL's occupancy for the default-on durability hold and records the post-trim sample on orleans.lattice.wal.gc.backlog_bytes wherever the provider accounts bytes, and a pass with no sample increments orleans.lattice.wal.gc.backlog_bytes_unavailable instead (reason="policy_disabled" while this option is unset, reason="provider_unsupported" when it is set), so "not measured" is reported rather than inferred from a missing series. The stranded arm in particular is reachable with this option off (issue #3213): it is decided by the trim scan's stop reason rather than by a byte sample, so a tree that reclaims nothing while its scan keeps stopping on WAL it must retain is distinguishable from a quiet one even where nothing accounts bytes. Set WalMaxRetainedBytes when the WAL volume has a hard size budget and the WAL provider accounts bytes; where the durability hold is disabled, it is also what makes the backlog histogram emit.
Setting it also changes the collection cadence, not only the reporting (issue #3119). A tree that is over the ceiling and reclaims nothing holds the adaptive interval at WalGcMinInterval instead of relaxing toward WalGcInterval, and reports the over_ceiling outcome rather than idle. This is deliberate and is what makes the ceiling enforceable at all: the trim itself can never cross the safe frontier, so when a lagging consumer pins that frontier, pass frequency is the only lever the policy has left, and the previous rule removed it at exactly the moment it was needed. Budget for it as a cost: the per-partition byte probe noted above is then paid at the floor rate for as long as the breach lasts, which is the same rate a reclaiming tree already sustains. It clears on its own once the tree drops back under the ceiling, so a ceiling set below what the tree can ever reach will hold that tree at the floor indefinitely; size the ceiling against a footprint the tree can actually return to. Leaving it off no longer forfeits the cadence correction entirely (issue #3213). A tree that reclaims nothing while retaining WAL is now held below the fault-retry ceiling rather than relaxing all the way to WalGcInterval, on every deployment and with no option set. Setting WalMaxRetainedBytes still buys the stronger guarantee - the cadence floor rather than a capped backoff - and it buys it against a budget the operator chose rather than against the mere presence of retained bytes.
WalDurabilityHoldCeilingBytes
Byte ceiling up to which the WAL garbage collector holds back a tree whose durable materialiser offset floor is absent - that is, when it cannot establish that any leaf has durably applied anything (default: 256 MiB, so the hold is on; null, 0, or any other non-positive value disables it). The ceiling is compared with the tree's WAL occupancy, sampled as WalMaxRetainedBytes samples it (physical bytes where the provider reports them, dead bytes included): below it such a partition is not trimmed; at or past it the collector trims anyway, because an unbounded WAL is the worse outage, and records each forced trim on orleans.lattice.wal.gc.durability_hold_forced. The hold engages only where the floor is absent, never where a floor exists but has stopped advancing, and only while every consumer cursor that admits trims is a leaf materialiser cursor the durable floor does not cover (or the cursor registry cannot be read), so a tree with a non-materialiser consumer such as a replication shipper that has advanced its cursor is never held, and a deployment with a materialiser wired enters it only transiently, while its floor is absent during a rolling upgrade or leaf churn, until the leaves re-pin (reason="pin_regressed" on orleans.lattice.wal.gc.durability_hold_engaged); and where the provider reports no byte size at all the hold declines rather than retaining without a bound. It is deliberately separate from the advisory WalMaxRetainedBytes, which never blocks a trim. See Metrics for durability_hold_forced and durability_hold_engaged.
WalPartitions
Per-tree, pinned at first registration. A tree pins the value in force for it when it is first registered in the tree registry - on its first use, through ILatticeTreeAdmin.CreateTreeAsync, or when an installed app registers it, in which case a manifest-declared walPartitions is pinned instead - so a silo-wide default change is non-breaking for already-registered trees - they continue to fan across whatever partition count they were created with. New trees pick up the current default unless an operator override is configured. System trees (ids beginning _lattice_) never consult this option or the registry pin: they always use a single WAL partition.
Activation-time replay is partition-aware. The leaf grain's activation-time materialiser iterates [0, WalPartitions) and runs an independent fall-off-log classification, slice read, and projection-checkpoint advance per partition. Per-partition checkpoints persist in the leaf's durable state as a nullable per-partition offset array (an additive serialization slot), with partition 0 also mirrored into the legacy scalar checkpoint slot so a downgrade to a host that has never observed multi-partition state still reads a valid single-partition shape. Per-partition cursor consumer ids take the form _lattice_materialiser_{treeId}_{leafGrainId}_{partition} so the WAL GC trims each partition independently against its own slowest consumer; on WalPartitions = 1 the legacy unsuffixed shape _lattice_materialiser_{treeId}_{leafGrainId} is preserved for wire compatibility with hosts that have never enabled multi-partition replay.
Must be >= 1. Values below 1 fail options validation.
WalMaterialiserPinShards
Number of durable-pin grain activations the per-tree leaf-materialiser checkpoint floor is spread across (default: 8). Each active leaf reports its per-WAL-partition projection frontier as a durable pin so the WAL garbage collector never trims past an entry a leaf has not yet projected. Historically every leaf in a tree funnelled its pin into a single per-tree grain, so a leaf-birth or split storm serialized O(leaves x partitions) durable writes through one activation and that activation became the bottleneck that wedged the drain path. Sharding spreads the load: each consumerId deterministically maps to one shard so the monotonic-max merge stays correct, and the WAL GC fans its read across every shard (plus the legacy single-key shape) so no trim floor is lost.
Set to 1 to restore the historical single-activation shape. Changing this value is a durable-store migration, and the two directions are not symmetric. The WAL garbage collector reads every shard under the current count (under both the current and the earlier shard-key separator) plus the legacy unsharded key, so raising the count keeps every existing pin readable. Lowering it stops the collector reading pins held by shards at or above the new count - and 1 reads only the legacy key - until each affected consumer re-pins under the new layout on its next report. A deliberate rollout (drain, change, redeploy) is therefore recommended rather than flipping it on a hot cluster. The value is read from the default (unnamed) options, so per-tree overrides do not apply, and it is not validated at startup: a value below 1 is treated as 1.
WalMaterialiserPinBuckets
The minimum number of durable state slots a single pin shard's blob is split across (default: 1, which is the historical single-slot layout and is byte-for-byte what every pre-bucketing build wrote while the shard is small). Orleans persists grain state as one whole blob, so a shard holding N consumer pins rewrites all N of them to record one leaf's advance. On a large tree that is a multi-megabyte write per flush, which is what made the pin store the bottleneck in issue #2012. Bucketing splits the persistence of one shard across several slots and rewrites only the slots whose contents changed, turning an O(consumers on the shard) write into an O(consumers in the bucket) one.
Buckets are the write dimension; WalMaterialiserPinShards is the read dimension. They are orthogonal, and that is the point of having both. Raising the shard count also shrinks each blob, but it widens the WAL garbage collector's per-pass grain fan-in by the same factor, because the collector must read every shard to compute the trim floor. Raising the bucket count shrinks the blob without touching that fan-in at all: one activation still answers for the whole shard and unions its buckets in memory, so reading a shard's pins still costs one grain call per shard. Reach for buckets when pin writes are slow, and for shards when pin calls are queueing.
The configured value is a floor, not the layout. The shard estimates its serialised size as pins change, and when a slot would exceed a 64 KiB byte budget it widens its layout by powers of two (up to 1,024 slots) until each slot is at most half that budget; the width it settled on is recorded in bucket zero. This is what keeps the default safe on a large tree: Orleans' Azure Table grain storage rejects any blob over 983,040 bytes, and before issue #3576 a shard at the default of 1 grew linearly with its consumer count (about 1 MB per 128k preseeded keys) until every flush and birth seed was rejected with Data too large. A provider rejection that reports an oversize payload also doubles the size estimate, so an estimate that under-counts drives a split rather than an identical retry. A failing write is retried after a backoff that doubles from 1 s to 60 s rather than on every flush tick; after three consecutive failures a birth seed or removal fails fast without touching the store (the pin is already merged in memory, which is what the WAL garbage collector reads, and it is made durable by the first successful flush). One coalesced flush writes at most eight slots, so a wide shard drains across several ticks instead of monopolising the non-reentrant pin grain.
Changing this value changes the durable layout but needs no migration step, and both directions are safe. Raising it: existing pins stay in the legacy slot, which every activation keeps reading, and each consumer's pin moves to its bucket the next time that consumer reports. Lowering it: an activation reads the wider layout it finds recorded in bucket zero, merges it, and consolidates into the narrower one only when the smaller layout still leaves each slot within half the byte budget; otherwise it stays at the recorded width, so no pin is stranded and no slot is pushed over the provider limit. An automatic widening follows the same crash-safe order as a configured one: the new slots are written before bucket zero records the new width, and the old slots are rewritten last, so an activation that dies part way through reads either the old layout or the new one in full. The direct-store write a leaf falls back to during silo teardown also routes by the width recorded in bucket zero. After a move out of the legacy slot, every activation keeps reading the legacy slot until every bucket that receives its pins has been written; the legacy slot is then emptied, so a consumer removed after the split is not resurrected from it at its pre-split frontier by the next activation. An activation that finds a non-empty legacy slot under a bucketed layout, including one a pre-#3576 build left behind at a bucket count of 2 or more, treats it as an unfinished move: it keeps every one of those pins, rewrites the buckets they route to, and then empties the legacy slot. Every read at activation is fail-closed: if bucket zero or any slot of the recorded layout cannot be read, activation fails and the WAL garbage collector reports the pin census as unavailable and retries, instead of computing a floor from a partial map, which could only raise it. A pass that cannot read the pin or offset census of any shard fails closed: it trims nothing, TTL included, and retries on the next pass.
Rolling upgrades and rollbacks. A build that predates #3576 does not read the width recorded in bucket zero, and once the legacy slot has been retired it holds no pins. If a pin shard reactivates on such a silo at a bucket count of 1 while a rollout is in progress, that silo sees none of the split shard's pins. During the rollout window, either drain the older silos before the new build starts serving, or run the whole cluster (old and new silos) at a bucket count of at least 2, ideally at or above the widest recorded width, so an older silo reads the buckets. The same applies to a rollback to an older build after a shard has split itself. As with the shard count, a deliberate rollout (drain, change, redeploy) is still preferable to flipping it on a hot cluster. It is read from the default (unnamed) options, so per-tree overrides do not apply. Must be >= 1; the validator rejects values below 1.
Pair with orleans.lattice.materialiser.pin.durable_write_latency and orleans.lattice.materialiser.pin.reports_shed when sizing: a sustained non-zero shed rate means the pin store is the bottleneck and the bucket count is the knob for it.
WalMaterialiserPinFlushIntervalMs
Debounce window, in milliseconds, over which a shard's durable pin writes are coalesced behind a grain-timer flush (default: 250 ms). Within the window the shard advances its in-memory monotonic-max frontier on every advancing report but persists at most one durable WriteStateAsync, collapsing a report burst into one durable write per shard per window. The coalescing only ever retains more WAL than an immediate write would (the persisted floor lags the in-memory floor by at most one window), so it is always GC-safe.
Set to 0 to disable coalescing so every advancing report persists synchronously, matching the historical shape. The value is not validated at startup; a negative value behaves like 0. It is read from the default (unnamed) options, so per-tree overrides do not apply.
This option can be changed freely at any time. The new value takes effect on the next pin report.
WalMaterialiserPinShedCeiling
Maximum time a durable leaf-materialiser pin shard may shed coalescible reports continuously before one is forced through (default: null, disarmed, which preserves the historical shedding exactly). Under sustained leaf-activation churn the non-sheddable pin writes can hold a shed window open indefinitely and starve the path that restamps materialiser coverage, so the durable pin stops advancing and the retained WAL grows. With a ceiling set, once a shard has shed for that long the next report is issued regardless and orleans.lattice.materialiser.pin.shed_forced records it, bounding pin staleness at the cost of at most one enqueued write per ceiling period per shard. Arming it cannot lose data. It is read from the default (unnamed) options, so per-tree overrides do not apply. The validator requires a positive value, or null.
WalMaterialiserMaxConcurrentReplays
Per-silo ceiling on the number of leaf grains that may run their activation-time WAL replay concurrently (default: -1, auto; 0 resolves at runtime to the lesser of Environment.ProcessorCount and the container's enforced CPU grant, which was the default before issue #5877). Auto resolves when the gate is sized: to 32 when the silo's registered WAL storage provider reports IWalStorageProvider.IsRemote (the Azure Table provider does), and otherwise, for the in-memory and file providers, to the same CPU-derived ceiling as 0 (issue #5957). A mass reactivation (for example after a docker restart or a silo rejoin) can otherwise stampede the scheduler as every reactivating leaf replays its WAL backlog at once; the ceiling makes the surplus queue on a process-wide gate and drain in waves instead. A no-op activation (a leaf with no tree binding) consumes no permit.
Why 32 on a remote store (issue #5877). A cold leaf replay against a remote WAL store spends almost all of its hold waiting on storage round trips, not CPU. On a 4-vCPU silo restarted cold under write load, the CPU-derived ceiling of 4 completed about 0.55 replays a minute while thousands of leaves queued, and 64 permits completed about 3.0 a minute before CPU saturated. The default is therefore sized for storage concurrency and paired with the replay concurrency controller, now on by default, which walks the ceiling down when storage throttles or replay slice reads slow - whether from storage or from in-process queueing - so on a CPU-bound host it settles toward the CPU knee. Past the CPU knee, a higher ceiling does not help. Once the silo's CPU is saturated, every additional replay shares the same cores, so raising this option only lengthens each hold, and a longer hold trips the admission gate's no_progress arm (see WalReplayPermitMaxQueueWait) sooner. Do not raise it to speed up a CPU-bound cold restart. On a 4-vCPU Azure Table silo the controller walked the ceiling from 32 to about 20 while the silo ran at 3.5 to 3.9 of its 4 cores, and it returns the withheld permits once CPU headroom reappears with leaves still queued (issue #5877; see the storage-pressure paragraph under WalReplayServiceRateControllerEnabled). Expect more storage queries. Up to 32 replays per silo, each issuing up to ReadBatchFetchConcurrency concurrent table queries on Azure Table, is up to about 256 concurrent replay queries per silo during a cold restart, against the previous handful. Why not 32 on a local store (issue #5957). Against an in-memory or file store a replay is CPU-bound, so 32 replays on a small host starve foreground grain turns, and the admission queue, which is a multiple of the ceiling (see WalReplayPermitQueueDepthPerPermit), deepens with it, turning fast refusals into request timeouts. The Azure Table provider reports remote even against a co-located Azurite emulator, so a host that runs it on the same machine as Azurite, such as a test or CI host, should set 0. To restore the previous behaviour set this option to 0 (the CPU-derived ceiling) and, for a fixed ceiling with no adaptation, set WalReplayServiceRateControllerEnabled to false. On a store that serialises writes, prefer 0 or a value tuned to the store, for the reason given below.
Why the grant and not the processor count alone. The ceiling is CPU-derived, so it is only meaningful against the CPU the process can actually obtain - a bound expressed in CPUs that is read off a figure the kernel does not enforce bounds nothing. Environment.ProcessorCount reflects the cgroup quota only while DOTNET_PROCESSOR_COUNT is unset - that variable overrides it, and overriding it is a legitimate thing to do for the thread pool's sake. A container granted 6 CPUs whose environment carries DOTNET_PROCESSOR_COUNT=16 therefore used to size this gate at 16, a 2.67x oversubscription of the CPU-derived ceiling, with nothing in the process able to tell (issue #2816). The default now reads /sys/fs/cgroup/cpu.max (and the cgroup v1 pair) directly and takes the minimum of the two figures, so a quota the kernel actually enforces can lower the ceiling but never raise it. An operator who lowers DOTNET_PROCESSOR_COUNT is still obeyed exactly, and every other subsystem sized from the processor count is untouched. An unreadable or unlimited quota - a non-Linux host, a container with no CPU limit - is treated as unknown, not as zero, and leaves the processor count as the ceiling.
The resolved ceiling, the configured option, the processor count, the grant, and the resolved managed heap ceiling are all written to the log once per process at silo start, so the effective figure can be read off the log rather than inferred from the host's vCPU count. The heap ceiling is reported there because the first four figures are all CPU quantities while the resource a concurrent replay exhausts first is the managed heap (issue #2784); a record carrying only the CPU side reads as a complete account of the sizing and is not one. It is reported as unknown when the runtime declines to supply it, which is a finding in its own right - heap occupancy then yields no verdict and the adaptive layer described below cannot engage on it.
The ceiling is sized once, but concurrency adapts beneath it (issue #2862). The sizing above is CPU-derived and correct as far as it goes, but on a mass reactivation the binding constraint is usually the heap, not the CPU: a whole-window replay buffers the window, so N concurrent replays hold N such buffers against one fixed managed ceiling. The gate therefore carries a memory dimension on top of the CPU-derived figure. A replay that finishes while managed heap occupancy is at or above 75% of the GC hard limit does not return its permit, and a replay that fails for memory pressure does not return its permit whatever the occupancy; a withheld permit is returned only when a replay completes cleanly and occupancy has receded below 60%. Those two figures are a hysteresis band, not one edge, so the gate settles at the concurrency the heap can afford rather than oscillating across a single threshold. Occupancy is a live reading that counts garbage not yet collected, so between full collections it can enter the withholding band on garbage alone, and withholding sheds none of it. The replay that reads pressure therefore also requests a non-blocking full collection, with at most one request outstanding, so such a withhold lasts as long as that collection takes rather than until the runtime's own full collection lands (issue #6166). When the collection that answered a request leaves occupancy at or above the restore threshold the heap is live, and nothing further is requested until the runtime runs a full collection of its own, so a live heap induces at most one collection per collection the runtime runs. The occupancy denominator is the GC hard limit (GC.GetGCMemoryInfo().TotalAvailableMemoryBytes, floored by the cgroup memory limit when one is readable) and not the container memory grant: under a container limit .NET applies its default GCHeapHardLimitPercent to the grant, so a 12 GiB grant yields a 9 GiB managed ceiling and a threshold written against the grant would sit 33% above the limit that actually throws. Backpressure never withholds the last permit, so the effective ceiling has a floor of one and the mechanism cannot latch, and it works by declining to return a permit already taken rather than by resizing, so it can never raise concurrency above the configured ceiling. Both arms of orleans.lattice.wal.replay.permit_adaptations are primed at zero when the gate is sized, so a flat zero is a measured zero rather than an absent series; the withheld arm additionally carries a trigger tag (occupancy or fault) naming which of the two mechanisms above withheld the permit, and each trigger value is primed separately (issue #2883). The counters are monotonic totals, so neither of them - nor their difference across two scrapes - can express what a process restart destroyed: the adaptation is held entirely in process memory, and a silo that dies at a withheld level of five starts again at zero with nothing in either series marking the discontinuity. orleans.lattice.wal.replay.permits_withheld is an observable gauge of that live level, published so the boundary is visible where a delta over the counters cannot show it (issue #2784). It is not a substitute for the counters: being sampled, a withhold and its restore that both fall between two scrapes leave it unchanged while the counters record both.
A warm activation takes its consistent cut before it queues for a permit - the cut's read returns every partition's readable head, so the replay's sweep is ordered from it and probes nothing of its own - since the cut reads no slice, so the permit is held only while the replay reads (#6166); a leaf that the cut proves has nothing to read holds its permit for no round trip at all. Set to a positive value to pin the ceiling explicitly; an explicit value supersedes both figures. Must be >= -1; the validator rejects any other negative value. The gate is sized once per silo process, from the resolved options of whichever leaf first takes a replay permit, and is never resized: a new value takes effect on the next silo start. Set it globally, because a per-tree override sizes the whole silo's gate only when a leaf of that tree happens to be first.
The CPU-derived default is an initial guess, and on a store-bound deployment it is the wrong one (issue #3921). Both inputs to the default are CPU quantities, which is correct only while a replay is CPU-bound. When the replay waits on the grain store instead - a store that serialises its writes, such as a single SQLite file behind ADO.NET - more permits do not finish more replays per second: each concurrent replay queues behind the same writes, so raising the ceiling only lengthens every hold. A long hold is what trips the admission gate's no_progress arm (see WalReplayPermitMaxQueueWait), so the gate then refuses more work, not less. Measured on one such deployment, pinning this option from the derived 6 to 16 raised saturation refusals by nearly half, raised timed-out index loads six-fold, took a cold open that had completed in 12 and in 26 minutes to one that did not complete in 45, and left five of six granted cores idle throughout. On a store-bound deployment tune this option to the store's write parallelism. Two instruments tell the regimes apart: orleans.lattice.wal.replay.permit_hold is how long each replay held its permit, and the rate of orleans.lattice.wal.replay.permits_served is the gate's service rate. If raising the ceiling raises the service rate, replays are CPU-bound and the ceiling was the constraint; if the service rate stays flat while hold time grows, the store is the constraint and the ceiling should come down. The replay concurrency controller, on by default since issue #5877, implements one-permit probes and storage-pressure steps; store-bound cold-open calibration remains tracked by issue #3933. See Metrics.
Starvation drives take a bounded, non-queueing share of the gate (issues #3480, #3575). The WAL GC sweep's starved-leaf drives and a leaf's own coverage-lag timer drives replay under this same gate, but they never queue for a permit, and together they hold at most half the replay permits in circulation - the resolved ceiling less any the heap backpressure described above is withholding - rounded down, but never below one, leaving the rest for ordinary activations. A drive that cannot take a free permit immediately within that share is refused at once, before it replays anything; the refusal is returned as a result rather than thrown, and is counted on orleans.lattice.saturation.refusals under the replay_permit_admission source with arm=gc_share. Within the share a coverage-lag timer drive never takes the last free slot, which is kept for the sweep - the only drive that clears a pin holding a tree's WAL cursor floor - and on a single-slot share the timer yields that slot while a refused sweep drive is outstanding; both of those timer refusals are counted with arm=timer_reserve instead, because they are the reservation working as designed and fire with most permits free (issue #6013). The sweep keeps no more of its touches in flight than the share it can use, so its own drives do not refuse each other, and re-drives a refused touch once a sibling touch of the same pass frees a slot (issue #3761); it records each refusal as the admission_refused outcome on orleans.lattice.wal.gc.blocked_leaf_reactivations, outside attempted, and retries a consumer still refused at the end of the pass after a jittered delay that doubles with each consecutive refusal; the timer counts its refusals, and the drive opportunities its backoff then skips, as the recheck_drive_refused and recheck_drive_deferred reasons on orleans.lattice.leaf.snapshot.driver.declines. While replays are queued on the gate, the timer's drive for a stalled checkpoint is not requested at all: it steps aside, stays owed for the next tick, and is counted as the recheck_drive_yielded reason (#5851). See Metrics.
This ceiling is one of two factors (issue #2867). Peak replay memory is the product of how many replays run concurrently and how much each one buffers, and the paragraph above is careful about the first while being silent about the second - which is how the ceiling came to be treated as the control. It is not. The per-replay factor is the slice width the replay reads the commit log in, and it is settable in its own right as WalReplaySliceBudget (issue #2898). Until that option existed the width was a private constant with no option, no environment variable and no overlay entry behind it, so lowering peak memory by lowering the width was not something configuration could express. Both terms of the product are now settable.
That matters because both ends of the one dial you do have are failure modes, so there is not always a setting that works. Set the ceiling too high and the concurrent whole-window buffers sum past the managed heap hard limit, an OutOfMemoryException cancels the activation, and the replay banks nothing. Set it too low and cold leaves queue for a permit past the request timeout, the runtime cancels the activation, and the replay again banks nothing. Either way no snapshot is banked, the durable materialiser pin stays unusable, and WAL garbage collection reports blocked - so the next replay window is larger than the one that just failed.
The configured width is a starting point, not a floor: a replay whose slice read fails for memory pressure narrows its own width to a quarter and retries the same range (issue #2742), a reactive, per-replay, per-activation adaptation that widens back towards the configured width on success and starts afresh at it on the next activation. Setting the option lowers the ceiling that adaptation works down from; it does not disable it. Whether it is engaging at all is visible in orleans.lattice.wal.replay.slice_narrowings, tagged by tree and partition and primed at zero, which is the instrument to read before concluding that a memory-pressure failure was caused by the slice width - a flat zero alongside climbing activation failures means the failing allocation was somewhere else and the width is not the lever. See Metrics.
The narrowing reached only the activation-time replay when it was introduced. Two further replay sites - the snapshot-cursor rebuild and the frozen-baseline tail fold - kept a constant of the same name and the same value and passed it straight through, so for a period the recovery path was the one without the resilience, and every check that compared the two values passed while the behaviour had diverged. All three sites now read through one shared reader that owns the width, the retry, the widening and the counter's priming together (issue #2899), and all three honour this option.
WalReplayPageRingBytes
Estimated bytes of WAL pages the per-partition replay coordinators of one silo may hold (default: -1, auto, issue #5877; introduced by issue #5896). Every leaf replaying a WAL partition reads its slices through that partition's coordinator, and without a cache each leaf read every page of the partition for itself, so a cold restart cost the number of leaves times the depth of the log in storage round trips (issue #5877). The coordinator now keeps the unfiltered pages it reads and projects each leaf's filtered slice from them, applying exactly the rule a filtered storage read applies, so each page is read once however many leaves replay it.
- Coverage. A page covers only up to the last entry its read actually returned, never the upper bound it asked for, so an offset that was not yet readable is never served as empty: anything above a page is read from storage.
- Incarnation. Each WAL partition carries a durable incarnation that every path resetting it advances (today, a tree purge, after trimming the partition). A page is served only while its partition is at the incarnation it was read at, checked in memory on every serve, so a purge and a recreate of the same tree id never serve the purged log, not even from a second, transient activation of the coordinator.
- Memory (issue #5877). Every coordinator's pages are charged to one silo-wide ledger, which shares its byte budget with resident leaves: a quarter of the heap limit, the same budget that sheds leaves. Pages always give way first, so a cached page never causes a leaf to be shed. With the default
-1, that shared budget is the only bound, except that when no heap limit can be read the pages are capped at 64 MiB. A positive value caps the pages further. The cache saves the most when it can hold the log a cold restart replays: everything appended since the oldest leaf checkpoint, across the silo's WAL partitions, at about96 + 2 x key length + value lengthbytes an entry (roughly 380 bytes for a 32-character key and a 220-byte value). On an Azure Table silo restarted cold under write load, a 217,000-entry log (about 82 MB) replayed 18 times faster with room for all of it than under a 64 MiB cap. A read in flight additionally holds the page it is reading, bounded byWalReplaySliceBudgetentries. - Eviction across partitions, by demand (issue #5877). A full ledger evicts across every partition, so a partition that fills later is never frozen out. A leaf queued for a replay permit declares the offset it will start reading each partition from, and every slice read advances its reader's position. The pages no queued or reading leaf still needs go first; then, if a partition has no declared readers, its most recently cached pages; and last, the pages whose next reader is farthest away. A cold restart replays in waves behind the permit gate, and each new wave reads the head of the log first, so this keeps the head and evicts what is needed latest. Measured on one partition in eight sequential waves with room for a quarter of the log, each entry was read 6.63 times, against 9.81 when the lowest pages were evicted first. Declarations are advisory and leased: they change which pages are evicted, never what a leaf is served, and a reader that stops reading lapses after 10 minutes.
- Isolation. Each leaf receives its own copy of every value buffer and version vector it is served, so nothing one leaf does to its slice reaches another.
- Owner index (issue #5997). Each cached page carries an index of its entries by key and by virtual slot, built once when the page is filled, so a leaf's slice visits only the entries its key range and shard can own instead of every entry in the partition's log. The index adds about 8 bytes per entry and is charged to the page's size in the shared ledger.
Set to 0 to disable the cache; every replay then reads storage itself, as before. The setting is silo-wide: it is read from the global options, so set it globally; a per-tree override has no effect. A WAL wiped out of band, behind the library's back rather than through a purge, is not detected: restart the silo, or set this to 0, before doing that.
WalReplayServiceRateControllerEnabled
Service-rate probing and storage-pressure stepping beneath the configured replay ceiling (default: true since issue #5877; it was an experimental opt-in under issue #3933). Set it to false for a fixed ceiling, for example on an in-memory or local store that has nothing to throttle. Set globally before the first leaf sizes the process-wide gate; the flag and ceiling are latched together. No host environment variable is introduced by this option.
The controller compares completed permit holds, not raw hold latency. During sustained queued demand it probes one fewer circulating permit, and keeps the reduction only if measured service rate does not fall. Each observation needs at least 30 seconds and eight completions. Replay work enrolls with a generation after physical acquisition and before work starts. After a limit change every hold enrolled before that change must complete before a new comparison window starts, including long cold holds; a fixed settling delay would not exclude those. Completion removes enrollment and records its sample under the accounting lock before physical release, so reacquisition and delayed diagnostics cannot corrupt the old-work census. At the floor it periodically tries one service-owned permit back to detect improved parallelism. Unsuccessful probes are reversed; four observation windows separate recovery probes, and an accepted probe has a one-window cooldown. Demand epochs, faults and memory changes invalidate comparisons; an ungraded probe is reversed only when the live heap permits it. Low or intermittent demand does not license a new reduction.
Separate ownership, shared bound. Memory recovery restores only memory-owned permits. The controller alone restores service-owned permits, and neither ledger can withhold the last circulating permit or exceed the original ceiling. The GC share and admission depth use the combined withheld count. Service adaptations reuse orleans.lattice.wal.replay.permit_adaptations with trigger=service_time on both outcomes, zero-primed only when enabled. Their difference is the service-owned level; the existing withheld gauge reports the combined level. Starvation drives contribute completed holds but do not themselves make service-rate decisions, so background-only demand does not train the controller.
Storage pressure (issue #5877). The same option also enables a storage-pressure governor with a third ledger of its own. It closes a window every 30 seconds and calls it pressured when the storage provider retried throttled or unavailable requests (HTTP 408, 429, 500, 502, 503 or 504) on at least 1% of the window's replay slice reads, or when the window's replay slice-read p99 reached twice its baseline. That latency is measured around the whole slice read, so it includes in-process queueing as well as storage time: on a CPU-bound host it rises when the silo itself is saturated, and the governor then walks the ceiling down toward the CPU knee even while storage is healthy. That is the intended way a default of 32 settles on a small host, and it is why the reason is tagged replay_latency rather than as storage. Because a ceiling walked down queues more work behind fewer permits, latency alone cannot see the knee move back, so the latency arm is bound to CPU (issue #5971): it withholds only while the process's CPU utilisation over the window is at or above 85% of the CPU it can obtain, and a window that is not throttled, has activations queued for a permit and runs below 60% returns half the withheld permits (at least one) whatever its latency, tagged storage_recovery. Throttle retries still withhold regardless of CPU. Latency is bucketed four buckets per power of two, so a bucket overstates a read by at most about 19% and a small drift across a power of two is not read as a doubling. Neither verdict is reached on thin evidence: a window needs at least 50 reads for the throttle ratio and 20 for the p99, and a sparser window steps neither way. The baseline is averaged from unpressured windows only, and latency is not judged until it is seeded. A pressured window withholds a quarter of the circulating permits (at least one) and starts a one-window cooldown; one permit returns after three consecutive clean windows. A quiet silo produces no judged windows, so once four windows' worth of time has passed with only sparse reads and no throttle retry at all, every storage-withheld permit is returned in one step, at the next activation's permit request; the next storm starts at the full ceiling. Retries on any storage request the provider makes count, including WAL appends and grain-state writes, not only replay reads. Fast down and slow up keeps a recovering storage account from being driven straight back into throttling. Each step moves one physical permit per replay release, never takes the last permit, and never raises the gate above the resolved ceiling, configured or default. Steps reuse orleans.lattice.wal.replay.permit_adaptations with trigger=storage_throttle or trigger=replay_latency on the withheld arm and trigger=storage_recovery or trigger=storage_idle on the restored arm, zero-primed only when enabled; orleans.lattice.wal.replay.permits_effective publishes the walked ceiling. Today only the Azure Table provider reports retries; any provider's slice latency is measured.
Validation boundary. The windows are an experimental starting policy, not a deployment-calibrated guarantee. Changing work mixes can still bias adjacent service-rate windows. Deterministic serial-store and CPU-scaling models establish controller behavior and the permit bounds, not cold-open latency or a reduction in real no_progress refusals. To calibrate it for a store-bound deployment, compare disabled/enabled cold opens on an isolated store-bound deployment with the same cold data trees, store, CPU/memory envelope and retry budget. Record completion, cold replay counts, refusals by arm, service rate, holds and peak withheld level. A warm vector-only File WAL cohort is not that acceptance run.
Heap evidence (#3614). Live occupancy remains the withholding and restore signal. Garbage-inflated occupancy is a hypothesis, not established by the implementation or hourly scrapes. Compare live managed bytes with completed full-gen2 heap minus fragmentation at actual permit transitions, without forcing collections. A low historical post-GC figure is not a restore license: a new allocation burst can arrive after that collection. Missing per-transition evidence is unavailable, never zero.
WalReplayPermitQueueDepthPerPermit
How many activations may queue for a WAL replay permit, per permit still in circulation (default: 4; 0 admits an unbounded queue, the historical shape). The admitted-waiter bound is this figure multiplied by the resolved ceiling less withheld permits (at least one) (see WalMaterialiserMaxConcurrentReplays), so it scales with the deployment's resolved ceiling - the CPU-derived figure, or 32 on a remote WAL store under the auto default. An activation refused admission gets a fast, attributable LatticeSaturatedException to retry after a backoff instead of a silent wait that would outlive its request deadline. A refusal is expected backpressure rather than a fault, so it is not logged per occurrence and carries no stack trace: each silo writes at most one warning a minute stating how many replays it refused since the previous one, and the exact count is on orleans.lattice.saturation.refusals under the replay_permit_admission source (issue #3906). Depth alone never refuses healthy fan-out. A fresh excessive smoothed wait refuses a non-empty queue independently of depth; the no-progress arm still requires this depth bound. Setting this option to zero disables both refusal arms. The validator rejects a negative value.
WalReplayPermitMaxQueueWait
The longest smoothed WAL replay-permit queue wait treated as healthy (default: 5 seconds; TimeSpan.Zero disables both time-based refusal arms). It is the demand-side half of the admission rule: depth alone says the queue is long, while this says it is not draining, which is what separates a wide but healthy fan-out from a self-sustaining backlog. A fresh mean reaching this threshold refuses a non-empty queue even below its depth bound (issue #4071). An empty queue is admitted, and a mean with no sample in the last threshold interval expires rather than latching refusal. No progress still requires the depth bound, so an idle interval cannot refuse a fresh burst. The validator rejects a negative value.
The not-draining half has two arms, the second split by what the permit holders are doing, and a refusal names the one that fired, in its message and as the arm tag on orleans.lattice.saturation.refusals (issue #3921). wait_exceeded: the smoothed wait of recently terminated permit waits is at or above this bound, so waits are completing but slowly; increasing WalReplayPermitQueueDepthPerPermit cannot suppress this time-based refusal. no_progress: no queued activation has acquired a permit for at least this bound, and no replay holding a permit has read a WAL slice in that time either, so the permits already issued are not coming back. holders_slow (issue #5877): no permit has been released for that long, but a permit holder read a WAL slice within it, so the holders are advancing, only too slowly for the demand - on remote WAL storage usually per-read latency multiplied by the window each leaf replays. Both are hold-time conditions, not queue-depth ones, and the queue-depth option does nothing for them; past the depth bound both refuse. Its refusal message reports how long it has been since a permit was released to the queue and points at replay and store throughput; if the replays are bound on the grain store, lowering WalMaterialiserMaxConcurrentReplays toward the store's write parallelism is the remedy and raising it makes the refusals more frequent. A permit withheld by memory backpressure also does not come back, which orleans.lattice.wal.replay.permits_withheld shows. The no_progress and holders_slow messages also list the activations recorded as holding a permit (grain id, tree, how long each has held it, and whether its permit is out on a nested call; up to eight are named), so a wedge or a slow queue names its holders; they also report the free permits and the queued waiters, so a permit stranded with no holder reads as zero free and no holder named. A replay does not hold its permit across a grain call that can itself need one (issue #5775): the registry shard-map lookup, the forward of a replayed commit to the leaf that now declares the key, and the tx-registry status resolve each return the permit to the gate for the call and queue for it again in FIFO order. The leaf is still inside its replay throughout, so it serves nothing in that gap. Nothing between a permit's grant and its release reads grain state: an activation can be invalidated while its replay runs, after which every state read throws, and a read on that path once stranded the permit for the life of the process. A replay whose leaf has already resolved its options is judged once before its snapshot rehydrate as well as at permit acquisition, so a re-armed replay that would be refused does not first spend a rehydrate (issue #5877); the check before the rehydrate changes no gate state, and the acquisition decides afresh.
A refused Interactive replay keeps its place in the queue (issue #6006). When the wait_exceeded arm refuses an Interactive replay, its callers are still refused at once with the same LatticeSaturatedException, but the replay's own wait for a permit stays parked in its arrival order instead of being abandoned, and it runs when its turn comes. A retry that finds the replay still parked is refused at once as well; once the replay holds a permit, callers wait for it as before. Retention is bounded: no new replay is retained while the retained count is at or above the permits in circulation, a walk-down of that count evicts nothing already retained, and a retained wait is dropped unadmitted after 10 minutes or when its leaf deactivates (including when the resident leaf working set sheds it). Bulk replays are never retained. A retained wait is the longest by construction, so it is kept out of the smoothed wait this option compares against, though it is still recorded on orleans.lattice.wal.replay.permit_queue_wait. Retained waits are queued waiters: they count toward the Interactive depth bound, so a fresh Interactive arrival can be refused on depth while replays are retained, and they show on orleans.lattice.wal.replay.permits_queued under retained=true. A Bulk arrival's own depth check excludes retained waits, and a Bulk arrival is also refused once the whole queue reaches the Interactive bound. A replay that would be retained is not refused before its snapshot rehydrate: it rehydrates and then parks, and if retention has filled in the meantime it is refused at acquisition instead, holding no permit.
WalReplayMaxRecordsPerTurn
Number of WAL records a single activation-time replay projects before yielding the Orleans turn cooperatively (await Task.Yield()), so a long replay does not monopolise the activation's turn and starve other grain calls on the same activation (default: 256). This is distinct from the cross-RPC slice width, WalReplaySliceBudget, which bounds how many entries a single slice read returns; this option bounds the synchronous run length within a single replay turn. They default to the same number and mean different things.
Set to 0 to disable the cooperative yield so replay runs to completion without voluntarily yielding (the historical shape). Must be >= 0; the validator rejects negative values.
WalReplaySliceBudget
Number of WAL entries a single replay requests per commit-log slice read, and the width it widens back towards after a memory-pressure narrowing (default: 256).
This is the second of the two factors that set peak replay memory (issue
#2898). Peak draw is the product of how many replays run at once and how much
each one buffers; the first factor is
WalMaterialiserMaxConcurrentReplays and
this is the second. Lowering it trades round trips for a smaller resident slice on
a host that cannot afford the default width.
It bounds what a slice returns; a slice served from the replay page cache may
examine more (issue #5997). A read from storage examines at most this many
entries, because storage must materialise an entry to filter it. A slice served
from the coordinator's page cache (see
WalReplayPageRingBytes) uses each cached page's owner
index to skip the entries the leaf does not own, so it may examine up to a fixed
64 times this budget while still returning at most this many entries plus one
trailing routing-only marker. A leaf replaying from cached pages therefore makes
up to 64 times fewer slice reads; the memory a slice holds is unchanged.
Do not confuse it with
WalReplayMaxRecordsPerTurn, which defaults to the
same number. That option bounds how many records a replay applies within one
scheduler turn before yielding cooperatively, and so governs silo responsiveness.
This one bounds how many entries a single cross-RPC slice read returns, and so
governs allocation. Changing one does not change the other.
The value is the starting width, not a floor. A read refused for memory pressure
is retried at a quarter of the current width, floored at a single entry, and widens
back towards this value on success - so configuring it lowers the ceiling the
replay works down from rather than disabling the adaptation. Whether the adaptation
is engaging is visible in orleans.lattice.wal.replay.slice_narrowings; see
Metrics.
All three replay sites honour it: the activation-time replay, the snapshot-cursor rebuild, and the frozen-baseline tail fold.
Must be >= 1; the validator rejects zero and negative values, because a single
entry is the narrowest legal read and a width of zero would request nothing and
never advance.