Skip to content

Instantly share code, notes, and snippets.

@jaeyson
Created October 7, 2025 11:12
Show Gist options
  • Save jaeyson/532f7638caa0cc0935d892c425036067 to your computer and use it in GitHub Desktop.
Save jaeyson/532f7638caa0cc0935d892c425036067 to your computer and use it in GitHub Desktop.
Redis/Valkey

Redis/Valkey changes, difference from the default Redis configuration.

If no max. is set, Redis/Valkey can use all the RAM. We want to avoid this and limit the RAM usage of the Redis server. If you want to limit the Redis process and to what extend, that is up to you. Don't forget to change the max memory policy (the default policy is not what you want). More info: https://valkey.io/topics/lru-cache/

I also bind only to IPv4. And created a valkey socket file with 777 permissions. And use io-threads (default is also 4 in Valkey).

bind 127.0.0.1
port 6379
unixsocket /var/run/valkey/valkey.sock
unixsocketperm 777
maxmemory 1GB
maxmemory-policy allkeys-lru
lazyfree-lazy-eviction yes
lazyfree-lazy-expire yes
lazyfree-lazy-server-del yes
replica-lazy-flush yes
lazyfree-lazy-user-del yes
lazyfree-lazy-user-flush yes
io-threads 4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment