Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions accounts-db/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ crossbeam-channel = { workspace = true }
dashmap = { workspace = true, features = ["rayon", "raw-api"] }
indexmap = { workspace = true }
itertools = { workspace = true }
libc = { workspace = true }
log = { workspace = true }
lz4 = { workspace = true }
memmap2 = { workspace = true }
Expand Down
7 changes: 7 additions & 0 deletions accounts-db/src/append_vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ use {
fs::{remove_file, File, OpenOptions},
io::{self, BufRead, Seek, SeekFrom, Write},
mem::{self, MaybeUninit},
os::fd::{AsFd, AsRawFd},
path::{Path, PathBuf},
ptr, slice,
sync::{
Expand Down Expand Up @@ -262,6 +263,12 @@ impl AppendVec {
})
.unwrap();

// tell the kernel that we expect to randomly access the file and not to bother using
// page cache and reading ahead
unsafe {
libc::posix_fadvise(data.as_fd().as_raw_fd(), 0, 0, libc::POSIX_FADV_RANDOM);
}

// Theoretical performance optimization: write a zero to the end of
// the file so that we won't have to resize it later, which may be
// expensive.
Expand Down