Set "no read ahead" on LMDB to improve performances when "LMDB size" > "RAM size" #855

Merged
quentin merged 1 commit from fix-lmdb-no-read-ahead into main 2024-08-18 12:25:36 +00:00

View file

@ -92,6 +92,7 @@ pub fn open_db(path: &PathBuf, engine: Engine, opt: &OpenOpt) -> Result<Db> {
env_builder.map_size(map_size); env_builder.map_size(map_size);
env_builder.max_readers(2048); env_builder.max_readers(2048);
unsafe { unsafe {
env_builder.flag(crate::lmdb_adapter::heed::flags::Flags::MdbNoRdAhead);
env_builder.flag(crate::lmdb_adapter::heed::flags::Flags::MdbNoMetaSync); env_builder.flag(crate::lmdb_adapter::heed::flags::Flags::MdbNoMetaSync);
if !opt.fsync { if !opt.fsync {
env_builder.flag(heed::flags::Flags::MdbNoSync); env_builder.flag(heed::flags::Flags::MdbNoSync);