Skip to content

Commit

Permalink
Increase maximum number of read-only mmap()s used from 1000 to 4096 o…
Browse files Browse the repository at this point in the history
…n 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.
  • Loading branch information
clemtaylor committed Aug 3, 2018
1 parent 64052c7 commit 4874cb8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions util/env_posix.cc
Original file line number Diff line number Diff line change
Expand Up @@ -585,8 +585,8 @@ static int MaxMmaps() {
if (mmap_limit >= 0) {
return mmap_limit;
}
// Up to 1000 mmaps for 64-bit binaries; none for smaller pointer sizes.
mmap_limit = sizeof(void*) >= 8 ? 1000 : 0;
// Up to 4096 mmaps for 64-bit binaries; none for smaller pointer sizes.
mmap_limit = sizeof(void*) >= 8 ? 4096 : 0;
return mmap_limit;
}

Expand Down

0 comments on commit 4874cb8

Please sign in to comment.