Skip to content

Commit e768478

Browse files
author
zorrobyte
committed
Switch Redis Config volatile-lru to allkeys-lru
#677 volatile-lru is a poor choice as it depends on the keys stored to be explicitly marked as purgable, something that the WordPress Redis plugin DOES NOT do. This means that an EE server running Redis will fill the cache, never to clean it unless it's purged via the Nginx plugin. Setting it to allkeys-lru ensures that the oldest used keys are always purged if out of RAM instead of segfaulting and massively slowing down a WordPress site.
1 parent ae270ff commit e768478

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

ee/cli/plugins/stack.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1907,24 +1907,24 @@ def install(self, packages=[], apt_packages=[], disp_msg=True):
19071907
if 'redis-server' in apt_packages:
19081908
# set redis.conf parameter
19091909
# set maxmemory 10% for ram below 512MB and 20% for others
1910-
# set maxmemory-policy volatile-lru
1910+
# set maxmemory-policy allkeys-lru
19111911
if os.path.isfile("/etc/redis/redis.conf"):
19121912
if EEVariables.ee_ram < 512:
19131913
Log.debug(self, "Setting maxmemory variable to {0} in redis.conf"
19141914
.format(int(EEVariables.ee_ram*1024*1024*0.1)))
19151915
EEShellExec.cmd_exec(self, "sed -i 's/# maxmemory <bytes>/maxmemory {0}/' /etc/redis/redis.conf"
19161916
.format(int(EEVariables.ee_ram*1024*1024*0.1)))
1917-
Log.debug(self, "Setting maxmemory-policy variable to volatile-lru in redis.conf")
1918-
EEShellExec.cmd_exec(self, "sed -i 's/# maxmemory-policy.*/maxmemory-policy volatile-lru/' "
1917+
Log.debug(self, "Setting maxmemory-policy variable to allkeys-lru in redis.conf")
1918+
EEShellExec.cmd_exec(self, "sed -i 's/# maxmemory-policy.*/maxmemory-policy allkeys-lru/' "
19191919
"/etc/redis/redis.conf")
19201920
EEService.restart_service(self, 'redis-server')
19211921
else:
19221922
Log.debug(self, "Setting maxmemory variable to {0} in redis.conf"
19231923
.format(int(EEVariables.ee_ram*1024*1024*0.2)))
19241924
EEShellExec.cmd_exec(self, "sed -i 's/# maxmemory <bytes>/maxmemory {0}/' /etc/redis/redis.conf"
19251925
.format(int(EEVariables.ee_ram*1024*1024*0.2)))
1926-
Log.debug(self, "Setting maxmemory-policy variable to volatile-lru in redis.conf")
1927-
EEShellExec.cmd_exec(self, "sed -i 's/# maxmemory-policy.*/maxmemory-policy volatile-lru/' "
1926+
Log.debug(self, "Setting maxmemory-policy variable to allkeys-lru in redis.conf")
1927+
EEShellExec.cmd_exec(self, "sed -i 's/# maxmemory-policy.*/maxmemory-policy allkeys-lru/' "
19281928
"/etc/redis/redis.conf")
19291929
EEService.restart_service(self, 'redis-server')
19301930
if disp_msg:

0 commit comments

Comments
 (0)