Redis 8.0 Async io-threads & Linux Kernel Tuning (redis.conf)
# Redis 8.0+ High-Throughput Production Configuration (/etc/redis/redis.conf)
# Prerequisite Linux sysctl (/etc/sysctl.d/99-redis.conf):
# vm.overcommit_memory = 1
# net.core.somaxconn = 65535
bind 127.0.0.1 -::1
protected-mode yes
port 6379
tcp-backlog 65535
tcp-keepalive 300
timeout 0
# 1. Redis 8.0 Redesigned Asynchronous Multi-Core I/O Engine
# Offloads socket reads, RESP parsing, and reply writes across cores (set to ~60-75% of physical cores, max 8-12)
io-threads 8
# 2. Memory Ceiling & Non-Blocking Lazy Eviction
maxmemory 16gb
maxmemory-policy allkeys-lfu
maxmemory-samples 10
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
# 3. Online Jemalloc Active Defragmentation (Prevents RSS bloat on variable-sized payloads)
activedefrag yes
active-defrag-ignore-bytes 256mb
active-defrag-threshold-lower 10
active-defrag-threshold-upper 100
active-defrag-cycle-min 1
active-defrag-cycle-max 25
# 4. Hybrid RDB + AOF Persistence & Latency Monitor
appendonly yes
appendfsync everysec
aof-use-rdb-preamble yes
no-appendfsync-on-rewrite yes
latency-monitor-threshold 5
slowlog-log-slower-than 2000
slowlog-max-len 512