From 9928b531027fd25a5b01354a317ffe298a17e192 Mon Sep 17 00:00:00 2001 From: antirez Date: Thu, 20 Mar 2014 17:05:42 +0100 Subject: [PATCH] Default LRU samples is now 5. --- redis.conf | 13 ++++++++----- src/redis.h | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/redis.conf b/redis.conf index 7a12bf33..f40d53e4 100644 --- a/redis.conf +++ b/redis.conf @@ -419,12 +419,15 @@ slave-priority 100 # maxmemory-policy volatile-lru # LRU and minimal TTL algorithms are not precise algorithms but approximated -# algorithms (in order to save memory), so you can select as well the sample -# size to check. For instance for default Redis will check three keys and -# pick the one that was used less recently, you can change the sample size -# using the following configuration directive. +# algorithms (in order to save memory), so you can tune it for speed or +# accuracy. For default Redis will check five keys and pick the one that was +# used less recently, you can change the sample size using the following +# configuration directive. # -# maxmemory-samples 3 +# The default of 5 produces good enough results. 10 Approximates very closely +# true LRU but costs a bit more CPU. 3 is very fast but not very accurate. +# +# maxmemory-samples 5 ############################## APPEND ONLY MODE ############################### diff --git a/src/redis.h b/src/redis.h index 34bb3ead..8103527e 100644 --- a/src/redis.h +++ b/src/redis.h @@ -113,7 +113,7 @@ #define REDIS_DEFAULT_SLAVE_READ_ONLY 1 #define REDIS_DEFAULT_REPL_DISABLE_TCP_NODELAY 0 #define REDIS_DEFAULT_MAXMEMORY 0 -#define REDIS_DEFAULT_MAXMEMORY_SAMPLES 3 +#define REDIS_DEFAULT_MAXMEMORY_SAMPLES 5 #define REDIS_DEFAULT_AOF_FILENAME "appendonly.aof" #define REDIS_DEFAULT_AOF_NO_FSYNC_ON_REWRITE 0 #define REDIS_DEFAULT_ACTIVE_REHASHING 1 -- GitLab