1
0
mirror of https://github.com/google/leveldb.git synced 2025-04-25 14:00:27 +08:00

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

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.

Original change by Clem Taylor. Ported to LevelDB 1.22 by Wladimir J. van der Laan.
This commit is contained in:
Lőrinc 2025-04-04 13:55:28 +02:00
parent ac691084fd
commit 415ecee603

View File

@ -43,8 +43,8 @@ namespace {
// Set by EnvPosixTestHelper::SetReadOnlyMMapLimit() and MaxOpenFiles().
int g_open_read_only_file_limit = -1;
// Up to 1000 mmap regions for 64-bit binaries; none for 32-bit.
constexpr const int kDefaultMmapLimit = (sizeof(void*) >= 8) ? 1000 : 0;
// Up to 4096 mmap regions for 64-bit binaries; none for 32-bit.
constexpr const int kDefaultMmapLimit = (sizeof(void*) >= 8) ? 4096 : 0;
// Can be set using EnvPosixTestHelper::SetReadOnlyMMapLimit().
int g_mmap_limit = kDefaultMmapLimit;