From 4874cb8d3e1dc7b9026b9faf51b9282c91f8ef40 Mon Sep 17 00:00:00 2001 From: Clem Taylor Date: Thu, 2 Aug 2018 22:05:46 -0400 Subject: [PATCH] Increase maximum number of 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. --- util/env_posix.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/util/env_posix.cc b/util/env_posix.cc index 4676bc2240c97b..f77918313eda73 100644 --- a/util/env_posix.cc +++ b/util/env_posix.cc @@ -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; }