refactor(durable-streams-rust): checkpoint cleanup — syncfs default-on (Linux), drop dead fsync fan-out#4707
Merged
Conversation
…n (Linux), drop dead fsync fan-out, refresh WAL_TUNING - --wal-checkpoint-syncfs defaults ON for Linux (validated +51% at the cliff, neutral below; off = escape hatch). Non-Linux unchanged (no syncfs). - Remove FSYNC_FANOUT / --wal-fsync-parallel: parallel per-file checkpoint fsync regressed in every controlled test (f8 -11% NVMe, f16 -19% constrained) and the syncfs barrier supersedes it. Flag accepted as a warning no-op so old deploy scripts don't crash. Checkpoint step 2 is now two modes: per-lane syncfs (Linux default) or the serial per-file fallback. - e2e resets restore the platform default instead of hard 'false'. - WAL_TUNING.md: stream-lanes results (1M wall broken), cardinality-based lane-split guidance, updated flag set, fd-ceiling note (#4706). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Y3x7bcT9vLGiT4tXZeQpnk
Base automatically changed from
perf/wal-stream-lanes
to
perf/wal-checkpoint-syncfs
July 13, 2026 21:54
balegas
added a commit
that referenced
this pull request
Jul 14, 2026
…yncfs checkpoints, per-shard triggers, stream lanes (#4697) Eliminates the WAL write cardinality cliff end-to-end. Formerly a 4-PR stack (#4704, #4705, #4707 folded in here). Full deployment guidance: `WAL_TUNING.md` (in this PR). **Validated by the canonical benchmark campaign 2026-07-14** (ds-bench#6: `results/REPORT.md` + `PROVENANCE.md`) run against this PR's head. ## The problem WAL-durable write throughput collapsed with stream count: **10.4k ops/s @100k streams** (vs ~110k @10k), degrading further under load. Two compounding causes: 1. The checkpoint issued **one `fdatasync` per touched stream** — an O(N) barrier storm sharing the device with commit fsyncs. 2. At extreme cardinality (~1M), checkpoint **writeback amplification** (~40× for small appends: dirty page + inode + extents + journal per file) saturated the single data device — one `syncfs` measured at 60–74 s. ## The changes | commit | what | measured effect | |---|---|---| | syncfs checkpoint | one `syncfs` barrier per stream lane instead of O(N-touched) `fdatasync` (unconditional on Linux) | +51% at the 100k cliff | | per-shard checkpoint triggers | `--wal-checkpoint-interval-ms` + `--wal-checkpoint-wal-bytes` (retained-WAL/replay budget; shards self-stagger, in-flight guard, panic-safe) | checkpoint cost ≈ 0 | | `--stream-lanes N` | hash stream data files across per-device lane dirs; N parallel per-lane syncfs; lane count persisted + validated on open | 1M wall broken: 68k → **212k** (syncfs 60–74s → 6–11s) | | cleanup | dead knobs removed (`--wal-fsync-parallel`, meta gates, meta-sweep toggles, `--tier local`); memory×tier rejected at startup; flag-clear WAL records decode as torn | smaller, safer surface | ## Results — canonical campaign 2026-07-14 (this PR's head, ideal configuration) **Write saturation** (`canonical-write`, 256 B appends, c4d-standard-64-lssd, 3 stream lanes + 3 WAL lanes, pinned cores): | streams | wal-ideal | memory (no-fsync ceiling) | |---|---|---| | 10k | 417k | 680k | | 100k | **382k (−8%, no cliff)** | 632k | vs 10.4k @100k pre-campaign = **37×**. At extreme cardinality (same config): 285k @500k, 212k @1m. **Reads** (unchanged by this PR, revalidated): catch-up 2.27–2.74 GiB/s, cardinality-flat 10→100 streams; SSE tail p99 2–3 ms up to 2048 connections. **Mixed interference**: 100k concurrent catch-up readers cost a pinned 50k ops/s write load nothing (303 MiB/s replay served alongside). The 2026-07-02 memory-mode delivery collapse no longer reproduces on this build: delivery tracks writes 1:1 to 127k/s (wal: keeps pace to ~40k, caps ~64k del/s at full write saturation). ## Correctness - The recoverability contract is unchanged: ack = WAL group-commit fdatasync; a WAL segment is recycled only after its records' stream bytes are fsynced AND the durable-tail map is persisted. All knobs only change *when/how* that sequence runs. - 105/105 tests: syncfs crash-recovery e2e, 3-lane crash-recovery + layout-spread + lane-mismatch rejection, memory-mode sidecar-skip regression, randomized crash sim. - CI green including all four conformance configs (`memory`, `wal-default`, `wal-read-offload-always`, `wal-resident-cache`). - Defaults preserve behavior except syncfs-on-Linux (extensively measured); `--stream-lanes` defaults to 1 = byte-identical layout. Changeset: patch. ## Follow-ups (tracked) - #4695 log-structured store (removes per-file writeback amplification structurally — the residual 100k→1M slope) - #4696 cold tier as durable store - #4706 lazy fd management (1 fd/live stream = 96% of the 1,048,576 ceiling at 1M streams) - #4709 io_uring experiment (measured as a regression in v1 form; default off, not for merge) 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01Y3x7bcT9vLGiT4tXZeQpnk --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Final PR of the cardinality-cliff stack (#4697 → #4704 → #4705 → this): now that the ideal disk-based implementation is validated end-to-end, clean up what the campaign obsoleted.
--wal-checkpoint-syncfsdefaults ON for Linux. Validated across the whole campaign: +51% at the 100k cliff, neutral-or-better everywhere below it, and with perf(durable-streams-rust): --stream-lanes — shard stream data files across per-device lane dirs #4705 it is onesyncfsper stream lane.offremains as the escape hatch; non-Linux is unaffected (nosyncfs, per-file loop as before).--wal-fsync-parallel/FSYNC_FANOUT. Parallel per-file checkpoint fsync regressed in every controlled test (f8 −11% on NVMe, f16 −19% CPU-constrained) — it steals device budget from the commit path — and the syncfs barrier supersedes it wholesale. The flag is accepted as a warning no-op so existing deploy scripts don't crash. Checkpoint durability (step 2) is now exactly two modes: per-lane syncfs (Linux default) or the serial per-file fallback.false.Verification
106/106 tests pass. No behavior change on non-Linux; on Linux the only default change is syncfs-on, measured extensively (suites: wal-syncfs, wal-splitlane, wal-sizetrigger, wal-stacked-1m, wal-streamlanes-1m).
🤖 Generated with Claude Code
https://claude.ai/code/session_01Y3x7bcT9vLGiT4tXZeQpnk