-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathredis.conf
More file actions
92 lines (74 loc) · 3.36 KB
/
Copy pathredis.conf
File metadata and controls
92 lines (74 loc) · 3.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# =============================================================================
# Redis Configuration for High-Throughput Log Ingestion
# Optimized for Redis Streams with consumer groups
# =============================================================================
# -----------------------------------------------------------------------------
# NETWORK
# -----------------------------------------------------------------------------
# Disable protected mode for Docker/development (enable in production!)
protected-mode no
# TCP keepalive for detecting dead connections
tcp-keepalive 300
# No client timeout (consumer groups need long-lived connections)
timeout 0
# Increase backlog for high connection bursts
tcp-backlog 511
# Max simultaneous clients (adjust based on worker count)
maxclients 512
# -----------------------------------------------------------------------------
# MEMORY
# -----------------------------------------------------------------------------
# Set memory limit (adjust based on your docker-compose limit: 1GB)
# Leave headroom for fragmentation and OS
maxmemory 1536mb
# Eviction policy: noeviction is safest for streams (don't lose data!)
# If memory fills up, Redis returns errors instead of dropping data
maxmemory-policy noeviction
# -----------------------------------------------------------------------------
# PERSISTENCE - AOF ONLY (no RDB snapshots)
# -----------------------------------------------------------------------------
# Enable AOF for durability
appendonly yes
appendfilename "appendonly.aof"
# Sync every second (good balance of durability vs performance)
appendfsync everysec
# Don't block writes during AOF rewrite
no-appendfsync-on-rewrite no
# Auto-rewrite AOF when it grows too large
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
# Disable RDB snapshots (AOF is sufficient, avoids double I/O)
save ""
# -----------------------------------------------------------------------------
# PERFORMANCE
# -----------------------------------------------------------------------------
# Enable I/O threads for better multi-core utilization
# Recommended: 2-4 threads for read-heavy workloads
io-threads 2
io-threads-do-reads yes
# Lazy freeing (async memory release - reduces latency spikes)
lazyfree-lazy-eviction yes
lazyfree-lazy-expire yes
lazyfree-lazy-server-del yes
# -----------------------------------------------------------------------------
# STREAMS OPTIMIZATION
# -----------------------------------------------------------------------------
# These are global defaults; you can override per-stream with XADD ... MAXLEN
# Active defragmentation (reduces memory fragmentation over time)
activedefrag yes
active-defrag-ignore-bytes 100mb
active-defrag-threshold-lower 10
active-defrag-threshold-upper 25
# -----------------------------------------------------------------------------
# LOGGING
# -----------------------------------------------------------------------------
# Log level: debug, verbose, notice, warning
loglevel notice
# -----------------------------------------------------------------------------
# NOTES
# -----------------------------------------------------------------------------
# For production:
# 1. Enable protected-mode and use proper authentication (requirepass)
# 2. Bind to specific interfaces instead of 0.0.0.0
# 3. Consider TLS for encryption
# 4. Monitor memory usage - streams can grow unbounded without MAXLEN