Skip to content

Add a knob to yield between Redwood lazy clear pages - #14609

Open
jmslocum16 wants to merge 6 commits into
apple:mainfrom
Snowflake-Labs:jslocum/redwood-lazy-clear-yield-upstream
Open

jmslocum16 wants to merge 6 commits into
apple:mainfrom
Snowflake-Labs:jslocum/redwood-lazy-clear-yield-upstream

Conversation

@jmslocum16

Copy link
Copy Markdown
Contributor

Redwood's lazy clear frees a cleared range in the background by reading internal pages and freeing or requeueing their children. Each batch of REDWOOD_LAZY_CLEAR_BATCH_SIZE_PAGES pages, with the hundreds of children of each, runs without yielding, so a large clear produces a burst of long tasks that delay reads. This adds REDWOOD_LAZY_CLEAR_YIELD_INTERVAL, which yields after that many processed pages at the priority the lazy clear started with. It defaults to 0 (never yield, the current behavior) and is randomized in simulation.

Results

The storage engine benchmark suite from #14603, on ssd-redwood-1, comparing this change with REDWOOD_LAZY_CLEAR_YIELD_INTERVAL=1 against the same base without it. Each configuration ran once on c5d.12xlarge hosts, with the storage server pinned to one core and a cache of 10% of the dataset, otherwise with default knobs. In the large clear test, the workload runs at 4000 tps with 32 client threads while a full-size second 100GB dataset is cleared at t=150s and lazily reclaimed.

Layout Read p50 before the clear → worst 5s window, before / after Read p99 before the clear → worst 5s window, before / after Reclaim rate (GB/s), before / after
single CF 0.62 → 3.35 / 0.75 → 1.97 9.84 → 17.95 / 9.33 → 15.94 5.7 / 5.6
multi CF 0.63 → 2.81 / 0.78 → 2.01 9.43 → 14.90 / 9.63 → 14.17 5.0 / 4.9

Yielding every page cuts the p50 spike during the clear by 30-40% without slowing reclaim. The p99 in this test is dominated by long storage server commit tasks, which the commit path yielding change in #14608 addresses separately. Outside the clear, latency and throughput are unchanged, as expected for a knob that only acts during lazy clear.

@saintstack
saintstack enabled auto-merge (squash) November 20, 2026 17:32

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants