summaryrefslogtreecommitdiff
path: root/redis.conf
diff options
context:
space:
mode:
authorYossi Gottlieb <yossigo@gmail.com>2020-08-12 17:58:56 +0300
committerGitHub <noreply@github.com>2020-08-12 17:58:56 +0300
commit2530dc0ebd8be8d792f4673073401377cd5bdc42 (patch)
tree7f942257c2f24bdc34f940d9880c09bacfa858df /redis.conf
parentf3df3ec1346565d96773aba9a4d315d614aeca4b (diff)
downloadredis-2530dc0ebd8be8d792f4673073401377cd5bdc42.tar.gz
Add oom-score-adj configuration option to control Linux OOM killer. (#1690)
Add Linux kernel OOM killer control option. This adds the ability to control the Linux OOM killer oom_score_adj parameter for all Redis processes, depending on the process role (i.e. master, replica, background child). A oom-score-adj global boolean flag control this feature. In addition, specific values can be configured using oom-score-adj-values if additional tuning is required.
Diffstat (limited to 'redis.conf')
-rw-r--r--redis.conf26
1 files changed, 26 insertions, 0 deletions
diff --git a/redis.conf b/redis.conf
index b8134e8c4..35ee752e1 100644
--- a/redis.conf
+++ b/redis.conf
@@ -1049,6 +1049,32 @@ lazyfree-lazy-user-del no
# --threads option to match the number of Redis theads, otherwise you'll not
# be able to notice the improvements.
+############################ KERNEL OOM CONTROL ##############################
+
+# On Linux, it is possible to hint the kernel OOM killer on what processes
+# should be killed first when out of memory.
+#
+# Enabling this feature makes Redis actively control the oom_score_adj value
+# 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.
+
+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).
+#
+# 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.
+
+oom-score-adj-values 0 200 800
+
############################## APPEND ONLY MODE ###############################
# By default Redis asynchronously dumps the dataset on disk. This mode is