summaryrefslogtreecommitdiff
path: root/redis.conf
diff options
context:
space:
mode:
authorOran Agra <oran@redislabs.com>2020-11-22 13:57:56 +0200
committerGitHub <noreply@github.com>2020-11-22 13:57:56 +0200
commit61954951edbda670bfbae8be0147daa64df95f26 (patch)
tree3d8f60f2b35c3f24b4283b9791909859e49dfc11 /redis.conf
parenta221a313ae689f1646e1a98969edf41bff4982e2 (diff)
downloadredis-61954951edbda670bfbae8be0147daa64df95f26.tar.gz
Fix oom-score-adj-values range, abs options, and bug when used in config file (#8046)
Fix: When oom-score-adj-values is provided in the config file after oom-score-adj yes, it'll take an immediate action, before readOOMScoreAdj was acquired, resulting in an error (out of range score due to uninitialized value. delay the reaction the real call is made by main(). Since the values are clamped to -1000..1000, and they're applied as an offset from the value at startup (which may be -1000), we need to allow the offsets to reach to +2000 so that a value of +1000 is achievable in case the value at startup was -1000. Adding an option for absolute values rather than relative ones.
Diffstat (limited to 'redis.conf')
-rw-r--r--redis.conf23
1 files changed, 14 insertions, 9 deletions
diff --git a/redis.conf b/redis.conf
index dcb5f6241..b1c8e4f0c 100644
--- a/redis.conf
+++ b/redis.conf
@@ -1086,21 +1086,26 @@ lazyfree-lazy-user-del no
# for all its processes, depending on their role. The default scores will
# attempt to have background child processes killed before all others, and
# replicas killed before masters.
-
+#
+# Redis supports three options:
+#
+# no: Don't make changes to oom-score-adj (default).
+# yes: Alias to "relative" see below.
+# absolute: Values in oom-score-adj-values are written as is to the kernel.
+# relative: Values are used relative to the initial value of oom_score_adj when
+# the server starts and are then clamped to a range of -1000 to 1000.
+# Because typically the initial value is 0, they will often match the
+# absolute values.
oom-score-adj no
# When oom-score-adj is used, this directive controls the specific values used
-# for master, replica and background child processes. Values range -1000 to
-# 1000 (higher means more likely to be killed).
+# for master, replica and background child processes. Values range -2000 to
+# 2000 (higher means more likely to be killed).
#
# Unprivileged processes (not root, and without CAP_SYS_RESOURCE capabilities)
# can freely increase their value, but not decrease it below its initial
-# settings.
-#
-# Values are used relative to the initial value of oom_score_adj when the server
-# starts. Because typically the initial value is 0, they will often match the
-# absolute values.
-
+# settings. This means that setting oom-score-adj to "relative" and setting the
+# oom-score-adj-values to positive values will always succeed.
oom-score-adj-values 0 200 800