From 6abc25a7e8eb1c6e93887b01e831ee6c5617f4c3 Mon Sep 17 00:00:00 2001 From: MattJackson <1085847+MattJackson@users.noreply.github.com> Date: Sun, 17 May 2026 08:25:44 -0700 Subject: [PATCH] iter7: WRITEBACK_CHUNK_BYTES 32 -> 64 MiB iter6 (8 MiB chunks) regressed mean -8.2 MB/s vs iter4 (32 MiB). Trend: bigger = better in this workload, against the page-age theory. Try 64 MiB to see if fewer/larger syncs raise mean further. 0.21.14 went to 128 MiB and was reverted; 64 is between. --- src/io/writeback_file/mod.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/io/writeback_file/mod.rs b/src/io/writeback_file/mod.rs index 0408ed9..f301435 100644 --- a/src/io/writeback_file/mod.rs +++ b/src/io/writeback_file/mod.rs @@ -122,15 +122,15 @@ use std::thread::{self, JoinHandle}; use super::writeback::WritebackPipeline; /// Granularity at which the Linux writeback pipeline issues -/// `sync_file_range` / `posix_fadvise(DONTNEED)` pairs. 32 MiB is the -/// historical default — bounded-cache pressure stays at ~2 × this size. +/// `sync_file_range` / `posix_fadvise(DONTNEED)` pairs. /// -/// iter6 (2026-05-17): 32 → 8 MiB. iter4 data showed ~30 s -/// oscillation (peak 45 → dip 3 MB/s with ~30 s period) matching -/// Linux's `vm.dirty_expire_centisecs` (30 s default). Smaller chunks -/// keep dirty pages younger so the kernel flusher daemon's bursts are -/// shorter. -const WRITEBACK_CHUNK_BYTES: u64 = 8 * 1024 * 1024; +/// iter7 (2026-05-17): 32 → 64 MiB. iter6 (8 MiB) regressed -8.2 MB/s +/// vs iter4 (32 MiB), confirming smaller=slower for this workload. +/// Trying bigger to see if fewer-but-larger syncs reduces overhead +/// further. 0.21.14 tried 128 MiB and was reverted — we don't know +/// whether that was measurement noise or a real TCP-buffer / NFS +/// commit issue. 64 MiB is the middle test point. +const WRITEBACK_CHUNK_BYTES: u64 = 64 * 1024 * 1024; /// Maximum bytes outstanding in the muxer → writer-thread ring. Sized /// to cover ~4 s of muxer output at a 32 MB/s peak — enough to absorb a