From 075b63b57b5256ca194502fc56a628b3c0954ae6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerg=C5=91=20M=C3=B3ricz?= Date: Tue, 8 Oct 2024 17:03:37 +0200 Subject: [PATCH] feat(redis): add memory calcualtion when not running on fly --- apps/redis/start-redis-server.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/apps/redis/start-redis-server.sh b/apps/redis/start-redis-server.sh index 30e4a145..45b92a95 100755 --- a/apps/redis/start-redis-server.sh +++ b/apps/redis/start-redis-server.sh @@ -10,14 +10,13 @@ if [[ ! -z "${REDIS_PASSWORD}" ]]; then PW_ARG="--requirepass $REDIS_PASSWORD" fi -# Set maxmemory-policy to 'allkeys-lru' for caching servers that should always evict old keys -: ${MAXMEMORY_POLICY:="volatile-lru"} +: ${MAXMEMORY_POLICY:="noeviction"} : ${APPENDONLY:="no"} -: ${FLY_VM_MEMORY_MB:=512} +: ${FLY_VM_MEMORY_MB:=$(($(grep MemTotal /proc/meminfo | awk '{print $2}') / 1024))} if [ "${NOSAVE}" = "" ] ; then : ${SAVE:="3600 1 300 100 60 10000"} fi -# Set maxmemory to 10% of available memory +# Set maxmemory to 80% of RAM MAXMEMORY=$(($FLY_VM_MEMORY_MB*80/100)) mkdir /data/redis