Skip to content

Commit

Permalink
Advises kernel to use random access for disk bucket mmaps (anza-xyz#2140
Browse files Browse the repository at this point in the history
)
  • Loading branch information
brooksprumo authored Oct 15, 2024
1 parent c32d0df commit 72963e1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions bucket_map/src/bucket_storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,10 @@ impl<O: BucketOccupied> BucketStorage<O> {
std::env::current_dir(),
);
});
// Access to the disk bucket files are random (excluding the linear search on collisions),
// so advise the kernel to treat the mmaps as such.
#[cfg(unix)]
mmap.advise(memmap2::Advice::Random).unwrap();
measure_mmap.stop();
stats
.new_file_us
Expand Down

0 comments on commit 72963e1

Please sign in to comment.