Skip to content

Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥

feat(redis): add memory calcualtion when not running on fly

Gergő Móricz075b63b57b52
diff --git a/apps/redis/start-redis-server.sh b/apps/redis/start-redis-server.sh
index 30e4a145f..45b92a954 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