fix(redis): configure maxmemory and eviction policy to prevent OOM
Some checks failed
Some checks failed
Redis had no maxmemory set, causing the Prometheus alert expression (used/max) to evaluate to +Inf. Set maxmemory to 100mb with allkeys-lru eviction policy, and guard the alert expression against division by zero. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -23,6 +23,7 @@ services:
|
||||
redis:
|
||||
image: redis:7-alpine
|
||||
restart: always
|
||||
command: redis-server --maxmemory 100mb --maxmemory-policy allkeys-lru
|
||||
ports:
|
||||
- "6380:6379" # Use 6380 to avoid conflict with host Redis
|
||||
mem_limit: 128m
|
||||
|
||||
@@ -140,7 +140,7 @@ groups:
|
||||
description: "Redis exporter cannot connect to Redis for 1 minute. Background tasks (emails, Celery) are not processing."
|
||||
|
||||
- alert: RedisHighMemoryUsage
|
||||
expr: redis_memory_used_bytes / redis_memory_max_bytes * 100 > 80
|
||||
expr: redis_memory_max_bytes > 0 and redis_memory_used_bytes / redis_memory_max_bytes * 100 > 80
|
||||
for: 5m
|
||||
labels:
|
||||
severity: warning
|
||||
|
||||
Reference in New Issue
Block a user