]> git.sur5r.net Git - openldap/commitdiff
Turn off readahead on main mmap
authorHoward Chu <hyc@symas.com>
Mon, 11 Mar 2013 12:49:14 +0000 (05:49 -0700)
committerHoward Chu <hyc@symas.com>
Mon, 11 Mar 2013 12:49:14 +0000 (05:49 -0700)
It's harmful when the DB is larger than RAM.

libraries/liblmdb/mdb.c

index 058c68b3ce8271009ffe2b3e1f6f1130549804a3..c086bd915e724fd8294c1601058a21105c99a892 100644 (file)
@@ -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) {