From 9a54ce0be0c253237d8c72601417cfdc8e1e5e1a Mon Sep 17 00:00:00 2001 From: martian56 Date: Sat, 25 Jul 2026 11:57:04 +0400 Subject: [PATCH] Use sixteen MiB log segments Postgres flushes sixteen MiB segments; ours were sixty four. Rotation is set below the segment size so a segment never has to be extended. --- storage/src/group_commit.rs | 2 +- storage/src/wal.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/storage/src/group_commit.rs b/storage/src/group_commit.rs index 725fd07..a83958d 100644 --- a/storage/src/group_commit.rs +++ b/storage/src/group_commit.rs @@ -44,7 +44,7 @@ impl Default for GroupCommitOptions { queue_depth: 1_024, max_batch_pages: 256, max_delay: Duration::from_micros(200), - checkpoint_after_wal_bytes: 64 << 20, + checkpoint_after_wal_bytes: 12 << 20, flush_pages_per_batch: 32, } } diff --git a/storage/src/wal.rs b/storage/src/wal.rs index 2da60c1..8f523d5 100644 --- a/storage/src/wal.rs +++ b/storage/src/wal.rs @@ -17,7 +17,7 @@ const NO_PAGE_ID: u64 = u64::MAX; /// in place, so the routine commit sync never touches file metadata. /// Growing a file on every append makes each sync journal a size change, /// which measured six times slower than syncing data blocks alone. -const WAL_PREALLOCATE_BYTES: u64 = 64 << 20; +const WAL_PREALLOCATE_BYTES: u64 = 16 << 20; /// How far ahead of the append position a segment is zero-filled. /// /// Reserving length with set_len leaves a sparse file, and writing into a