---
title: "Options Reference: WalGcInterval to WalRetention - Configuration"
url: "https://nsta1.github.io/Orleans.Lattice/docs/lattice/configuration/options-reference-6.html"
source: "https://github.com/NSTA1/Orleans.Lattice/blob/release/10.5/docs/lattice/configuration.md?plain=1#L2018-L2080"
agent_spec: "https://nsta1.github.io/Orleans.Lattice/docs/agents/deployment.yaml"
package: "Orleans.Lattice"
version: "10.5.0"
documents: "Orleans.Lattice 10.5.0 (release line 10.5)"
built: "2026-12-05"
all-pages: "https://nsta1.github.io/Orleans.Lattice/llms.txt"
bundle: "https://nsta1.github.io/Orleans.Lattice/docs/lattice/llms-full.txt"
---
# Options Reference: `WalGcInterval` to `WalRetention`

Part of [Options Reference](options-reference.md), in [Configuration](../configuration.md).

## `WalGcInterval`

Upper bound on the cadence at which the per-silo core WAL garbage-collection scheduler runs a `ILatticeWalGc.RunOnceAsync` pass over **every** registered tree (default: 1 hour, **enabled**). This is the *quiet-path* ceiling of an adaptive band whose floor is [`WalGcMinInterval`](#walgcmininterval): a tree that is reclaiming entries is collected far more often, and relaxes back to this interval once it has nothing left to reclaim. The core library ships the WAL garbage collector, but historically only drove it for *replicated* trees (via the replication package's per-tree maintenance grain). That left two retention gaps: a durable-WAL host that runs **without** the replication package never trimmed its WAL at all, and every **non-replicated** tree in a replicated host was never collected - both grew without bound, and `WalRetention` was inert for them. The built-in scheduler closes the gap by collecting every registered tree, replicated or not, so `WalRetention` is effective with no further configuration wherever the scheduler runs. It runs only where the WAL garbage collector is registered: `AddLatticeWalGc` installs both, and the durable WAL provider registrations (`AddAzureTableWalStorage`, `AddFileWalStorage`) and `AddLatticeReplication` call it for you, but `AddLattice` alone does not, so a host that supplies its own durable provider through `AddWalStorage(factory)` calls `AddLatticeWalGc` itself.

A pass is retention housekeeping, not a latency-sensitive operation. Its cost scales with `trees x WalPartitions` storage reads (a head scan plus a trim per partition) and runs on every silo, so this ceiling is deliberately coarse to keep the **idle** storage cost low. Lowering it would only make a quiet tree poll more often, paying for passes that reclaim nothing, while buying no responsiveness on a tree that has work to do - that is what the floor is for. A host that needs a tighter disk bound - a high write rate paired with a small `WalRetention` - can lower it; `TimeSpan.Zero` (or any non-positive value) **disables** the scheduler entirely, restoring the historical caller-driven behaviour.

The first pass is not run at silo start: it is staggered by [`WalGcStartupDelay`](#walgcstartupdelay), a random offset of half to one full stagger window (15 to 30 seconds by default), so the silo finishes activating before the scheduler adds scan/trim I/O and a rolling cluster restart does not align every silo's fan-out into a correlated I/O storm.

```csharp verify
// Tighten the cadence on a high-write durable-WAL host, or disable it.
siloBuilder.ConfigureLattice(o => o.WalGcInterval = TimeSpan.FromMinutes(5));
siloBuilder.ConfigureLattice(o => o.WalGcInterval = TimeSpan.Zero); // disable
```

The scheduler composes with the replication maintenance grain (which collects replicated trees on its own faster cadence): `RunOnceAsync` and the underlying WAL `TrimAsync` are idempotent, and the pass never trims past the minimum consumer cursor or the leaf-materialiser checkpoint floor, so a tree collected by both drivers is trimmed safely and it never over-trims. A per-tree GC failure is logged and skipped without stalling the rest of the pass. This is a **global** knob read from the default (unnamed) options; per-tree overrides do not apply. It is read once when the scheduler starts; change it before silo start to take effect.

## `WalGcMinInterval`

Floor of the WAL garbage collector's per-tree adaptive cadence band (default: 30 seconds). [`WalGcInterval`](#walgcinterval) is the ceiling.

The scheduler tracks a cadence per registered tree. A pass that reclaims at least one entry sets that tree's next interval to this floor; a pass that reclaims nothing, or throws, doubles it geometrically up to the ceiling. A tree with a growing log is therefore collected every 30 seconds while it has work to do, and a quiet tree relaxes back to the hourly ceiling. The `orleans.lattice.wal.gc.interval` histogram publishes the cadence chosen for each tree, so a series pinned at the floor means a log that is still growing.

A **blocked** tree is one exception, and is also held at this floor. A pass that reclaimed nothing because an unusable durable leaf-materialiser pin disabled the consumer-cursor branch (`outcome="blocked"` on `orleans.lattice.wal.gc.passes`) is not a quiet tree: it cannot reclaim at all, and its WAL grows without bound. Backing it off would give it the fewest passes precisely when it needs the most, and because the same observation drove both the label and the cadence, the backoff was previously self-reinforcing - being unable to reclaim was itself the evidence used to decide to look less often (issue #2702). Holding it at the floor also bounds recovery: whatever repairs the pin, the stranded bytes do not return until a pass runs and trims them, so this floor is the time-to-reclaim after a repair. The floor introduces no new load level, because a reclaiming tree already runs at it indefinitely, and it is not a latch - a tree that stops being blocked relaxes exactly like any other quiet tree. The other two exceptions are described under [`WalMaxRetainedBytes`](options-reference-5.md#walmaxretainedbytes): a tree over its byte ceiling is also held at this floor, and a tree that reclaims nothing while its scan keeps stopping on WAL it must retain (`outcome="stranded"`) relaxes only as far as the faulted ladder's cap described below (five minutes at the defaults) rather than to `WalGcInterval`.

**Cost:** a pass on a tree with a backlog is exactly the pass that would have run later anyway; the adaptivity moves the work earlier rather than adding it. A tree with nothing to reclaim relaxes off the floor within a few passes. A tree that is blocked and cannot recover polls at the floor indefinitely; that is the alarm state, and its cost is bounded by the floor while the unbounded WAL growth it signals is not.

**Separately from the per-tree cadence, the scheduler runs two silo-wide ladders**, for the two conditions in which a pass has no per-tree cadence to set at all. Both start at this floor and double geometrically, and both are published as `orleans.lattice.wal.gc.scheduler_backoff`, tagged `cause`.

- **`cause="empty"`** - the tree registry was read successfully and holds no collectable tree. That is a correct observation of an idle silo rather than a fault, so this ladder relaxes all the way to [`WalGcInterval`](#walgcinterval): an empty host costs nothing, while one whose first tree is about to register still picks it up promptly.
- **`cause="faulted"`** - the registry could not be read at all. This ladder is capped far lower, at five minutes clamped into `[WalGcMinInterval, WalGcInterval]`, because the wait a faulted pass picks **is the operator's blindness window**: the scheduler has learned nothing, so it cannot notice the fault clearing until it next tries. Sharing the quiet ceiling made that window up to a full `WalGcInterval` - an hour at stock defaults - during which a silo that had already recovered was indistinguishable from one that was dead (issue #3064). The cap bounds recovery without retrying hard: the enumeration that failed is a full key-range scan across every registry shard, so retrying it at the floor forever is how a transient fault becomes a storm.

A pass that finds trees and schedules their ordinary per-tree cadences records `cause="scheduled"` at the floor instead, meaning no scheduler-wide backoff is in force. That arm is recorded on every healthy pass, so it is also what shows the series is deployed at all.

Either ladder resets to the floor on the next pass that finds work, and the **faulted** ladder additionally resets on any pass whose enumeration merely succeeded - including one that found nothing. A registry that answered "nothing here" has proved it can be read, which is the only thing that ladder measures. Pair the backoff series with `orleans.lattice.wal.gc.scheduler_consecutive_faults`, which reports the current fault streak and returns to a measured zero on the first success.

**When off:** a non-positive value, **or any value above `WalGcInterval`**, collapses the band to `WalGcInterval`, which reproduces the historical fixed-interval tick exactly. Both spellings are honoured; neither is a validation error.

**When an operator would turn it off:** if the responsive cadence is producing more storage traffic than the retention it buys is worth - typically a host with very many quiet trees whose logs never grow.

Like `WalGcInterval`, this is a **global** knob read from the default (unnamed) options once, when the scheduler starts; per-tree overrides do not apply.

## `WalGcStartupDelay`

Upper bound on the randomized delay before a silo's WAL garbage collector runs its **first** pass (default: 30 seconds). The scheduler draws a uniform offset in `[delay / 2, delay)`, so the first pass lands 15 to 30 seconds after start. The value is capped at [`WalGcInterval`](#walgcinterval), so a host never waits longer for its first pass than its own ceiling.

The floor of half a window keeps the first pass out of the silo's activation storm; the random component de-correlates silos so a rolling restart does not align every silo's fan-out into one I/O spike.

Before this existed the first pass was drawn from `[WalGcInterval / 2, WalGcInterval)` - 30 to 60 minutes at the shipped ceiling - which meant a freshly restarted silo did no WAL collection at all for up to an hour. On a box whose leaves cannot resume replay until the WAL prefix is actually trimmed, that hour is a cold start that never converges.

**Cost:** one fan-out earlier in the silo's life than before.

**When off:** `TimeSpan.Zero` (or any non-positive value) means no stagger at all and runs the first pass immediately, forfeiting both the activation-window guard and the de-correlation. To restore the **historical** deferral instead, set it equal to `WalGcInterval`: the draw is then `[interval / 2, interval)`, exactly as it was. These are two different settings and it is worth being deliberate about which one you want.

**When an operator would change it:** lengthen it on a silo whose activation storm is long enough that 15 seconds is still inside it; set it to `WalGcInterval` when the early first pass itself is the problem.

This is a **global** knob read from the default (unnamed) options when the scheduler starts.

## `WalRetention`

Optional wall-clock hard ceiling on WAL retention (default: `null`, disabled). When set, the WAL garbage collector trims entries whose HLC wall-clock is older than `now - WalRetention` regardless of consumer cursor position, bounding worst-case disk usage even when a registered consumer is hopelessly behind. The lagging consumer then "falls off the log" on its next read, surfacing the gap to the auto-bootstrap trigger (replication-side concern). The ceiling never overtakes a leaf materialiser, however (issue #4622): it stops at the partition's durable materialiser offset floor, a partition a leaf's block pin or override hold names admits nothing (issue #4641), and an uncovered leaf pin caps the ceiling at its frontier, so a leaf that never checkpoints or captures holds its partitions past the window. Watch `orleans.lattice.wal.gc.leaf_pin_hold_age` for that (see [Write-ahead log](../wal.md)). When `null`, the GC predicate is purely `min(consumer cursors)`, and a lagging consumer pins the WAL until it catches up. Must be strictly greater than `TimeSpan.Zero` when set. The core options validator does not enforce that (the replication package's `LatticeReplicationOptions.WalRetention`, which is copied into this option when this one is unset, is validated): a zero or negative value puts the TTL ceiling at or after the current time, so the TTL clause then admits effectively every entry for trimming.

This option can be changed freely at any time. The new value takes effect on the next GC tick.

Previous: [Options Reference: WalMaxRetainedBytes to WalReplaySliceBudget](options-reference-5.md). Next: [Materialised view options](materialised-view-options.md). Contents: [Configuration](../configuration.md).
