Repository navigation
id(world): shared sync epochs for journal appends (#557) — DRAFT, negative result, do not merge - #12496
Draft
dezren39 wants to merge 1 commit into
Draft
id(world): shared sync epochs for journal appends (#557) — DRAFT, negative result, do not merge#12496dezren39 wants to merge 1 commit into
dezren39 wants to merge 1 commit into
Conversation
Durability-before-ack cost one sync_data per journal append. At the F12.12 load (100 active worlds x 20 inputs/s = 2,000 syncs/s), concurrent fdatasync across 100 journal files serializes in the filesystem well below the offered rate, so the sync layer — not service time — caps throughput and the backlog lands in the many-worlds p99 (felix profile, 2026-11-22: input/ack p99 379 ms on the reference laptop; sandbox before-run: 170 of 2,000 offered inputs/s completed). FileJournal writers now prove durability through a per-filesystem SyncGate: the writer writes its bytes, registers the next epoch, and waits for a syncfs that started after its registration — one sync covers every pending append on the filesystem, and syncs run back-to-back under load. A failed or unavailable gate sync settles the epoch as failed and the writer falls back to its own sync_data, so the append's result is decided exactly as before. Non-Linux builds keep the per-append sync_data path unchanged. Oracles (new tests, world_store): a waiter is released only by a sync that starts after it registered (latch-controlled sync); 256 concurrent waits settle in a handful of shared syncs; a failed sync releases the waiter with an error, never a false durable; appends through the gated writer land exactly and in order. Existing world_store tests (49) stay green.
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
This branch has not been deployed
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.
Summary
DRAFT — DO NOT MERGE. This is a negative result, recorded as a PR so the evidence is reviewable.
One slice attempt for the #557 F12.12 p99 criterion, aimed at the input/ack cost in felix's 2026-11-22 profile (PR #12471): after group commit (#8239), durability-before-ack still costs one
sync_dataper journal append, and at 100 worlds × 20 inputs/s the filesystem's aggregate sync rate was the suspected cap.This branch routes
FileJournalappends through a per-filesystem SyncGate (crates/id-worlds/src/world_store.rs): the writer writes its bytes, registers the next epoch, and waits until asyncfsthat started after its registration completes; a failed or unavailable gate sync falls back to the writer's ownsync_data, which decides the append exactly as before. The mechanism is correct — the measurements below saysyncfsis the wrong primitive on every filesystem measurable from the sandbox lane.Evidence
Tests (all green):
world_store: a waiter is released only by a sync that starts after it registered (latch-controlled sync); 256 concurrent waits settle in ≤ 32 shared syncs; a failed sync releases the waiter with an error, never a false durable; appends through the gated writer land exactly and in order.cargo test --release -p id-worlds --libvia fleet-run on this branch: 873 passed, 0 failed — https://github.com/developing-today/fleet/actions/runs/45009277444*_netmodules ("connect to world host: timed out"; sandbox UDP is blocked). The fleet run of the identical suite is 873/873, so those are environmental.Harness —
cargo bench --bench world_bench -- --only journal_append_fsyncand--only many_worlds:Fleet runner (same machine class, main vs this branch):
Muse sandbox (btrfs home volume, 1.5 shared vCPU, TMPDIR on the home disk; this machine is CPU-quota-bound at this load, so its many_worlds rates mix CPU contention with sync cost — the microbench delta is the clean signal):
Reading: one
syncfscosts ~2.5× onefdatasyncon the fleet filesystem and ~1.26× on the sandbox btrfs (where it also flushes a large, busy home volume and burns contended CPU). Sharing syncs only pays when the shared sync is cheaper than the sum it replaces; on both filesystems measured here it is not. The one machine where the criterion actually fails — the reference laptop (ext4) — is felix's live thread on #557 and cannot be measured from this lane;syncfsis unpriced there.Merge Danger
Not mergeable on this evidence: it regresses the journal microbench on both measured filesystems. Kept as a draft for the record; the durability design (registration-after-write, covering-sync ordering, fallback-decides) and its oracle tests are sound and reusable if a cheaper shared-sync primitive is ever priced on the target machine. Baseline files are untouched; the recorded reference baseline on #557 remains felix's thread.
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.