From: Howard Chu Date: Mon, 11 Mar 2013 12:49:14 +0000 (-0700) Subject: Turn off readahead on main mmap X-Git-Tag: OPENLDAP_REL_ENG_2_4_35~26^2~5 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=b1da555c4c7275d7f756d693c42814388a9aa839;p=openldap Turn off readahead on main mmap It's harmful when the DB is larger than RAM. --- diff --git a/libraries/liblmdb/mdb.c b/libraries/liblmdb/mdb.c index 058c68b3ce..c086bd915e 100644 --- a/libraries/liblmdb/mdb.c +++ b/libraries/liblmdb/mdb.c @@ -2870,6 +2870,8 @@ mdb_env_open2(MDB_env *env) env->me_map = NULL; return ErrCode(); } + /* Turn off readahead. It's harmful when the DB is larger than RAM. */ + posix_madvise(env->me_map, env->me_mapsize, POSIX_MADV_RANDOM); #endif if (newenv) {