leveldb icon indicating copy to clipboard operation
leveldb copied to clipboard

Increase maximum read-only mmap()s used from 1000 to 4096 on 64-bit systems

Open l0rinc opened this issue 7 months ago • 4 comments
trafficstars

Cherry-picking https://github.com/bitcoin-core/leveldb-subtree/commit/92ae82c78f225de84040c51e07fd0b4a61caed99 and revives https://github.com/google/leveldb/pull/613

l0rinc avatar Apr 04 '25 11:04 l0rinc

i'm confused, maybe there is value in changing the default, but why do we patch leveldb here when it could be set from client code:

// Can be set using EnvPosixTestHelper::SetReadOnlyMMapLimit().

laanwj avatar May 08 '25 09:05 laanwj

Are you suggesting we revert it in Bitcoin instead?

l0rinc avatar May 08 '25 10:05 l0rinc

Ideally yes, looking into it. Sure, upstream leveldb might still want to change this default but i find it hard to argue "why 4096".

Hah i like the commit message:

By default LevelDB will only mmap() up to 1000 ldb files for reading and then fall back
to using file desciptors.

The typical linux system has a 'vm.max_map_count = 65530', so mapping only 1000 files
seems arbitarily small. Increase this value to another arbitrarily small value, 4096.

laanwj avatar May 08 '25 10:05 laanwj

Okay this turned out so much worse than i hoped, on the upside, maybe we can just drop this patch: bitcoin/bitcoin#32447

laanwj avatar May 08 '25 11:05 laanwj