gabriel / muse public
perf BREAKING task/bulk-fsync-apply-mpack #1 / 1
AI Agent gabriel · 23 days ago · May 18, 2026 · Diff

perf: batch fsync in apply_mpack — one dir fsync after all writes

On Linux each fsync costs ~5ms. Writing 2000 commits + 2000 snapshots with per-file fsyncs adds ~20s of pure barrier overhead on staging (ECS). On macOS F_BARRIERFSYNC is ~0.1ms so localhost masked this completely.

Fix: write_commit and write_snapshot gain sync=False mode that skips the per-file fsync. apply_mpack passes sync=False for all bulk writes, then does one os.fsync on the commits/ and snapshots/ directories after all renames complete. Same durability guarantee as git pack writes — the ref is not advanced until apply_mpack returns, so a mid-write crash leaves the store consistent and re-applyable.

sha256:dc122e6963280a93b9be32d33aa998c7b9487273b70050e4450604ebaf8d3894 sha
sha256:a3f9c13a8435c239681cc7a911676a5634511bcf41ad85cb13c374ecefaf649d snapshot
← Older Oldest on task/bulk-fsync-apply-mpack
All commits
Newer → Latest on task/bulk-fsync-apply-mpack

0 comments

No comments yet. Be the first to start the discussion.

To add a comment, use the Muse CLI: muse hub commit comment sha256:dc122e6963280a93b9be32d33aa998c7b9487273b70050e4450604ebaf8d3894 --body "your comment"