-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathredis.conf
More file actions
88 lines (73 loc) · 2.4 KB
/
redis.conf
File metadata and controls
88 lines (73 loc) · 2.4 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
# Redis Configuration for ProStaff API
# Optimized for Sidekiq + Rails Cache + Rate Limiting
# Network
bind 0.0.0.0
port 6379
timeout 300
tcp-keepalive 60
# General
daemonize no
# Use systemd/docker supervision for better integration
supervised auto
loglevel notice
# Persistence - RDB Snapshots (for job queue persistence)
# Save after 15min if at least 1 key changed
save 900 1
# Save after 5min if at least 10 keys changed
save 300 10
# Save after 1min if at least 10000 keys changed
save 60 10000
# Persistence - AOF (Append Only File) - Disabled for performance
# Sidekiq can recover from crashes, cache is transient
appendonly no
# Memory Management
maxmemory 256mb
# LRU eviction for cache
maxmemory-policy allkeys-lru
# Lazy freeing for better performance under memory pressure (Redis 4+)
lazyfree-lazy-eviction yes
lazyfree-lazy-expire yes
lazyfree-lazy-server-del yes
replica-lazy-flush yes
# Performance
# Multiple DBs for separation
# NOTE: For high-traffic scenarios, consider separate Redis instances
# instead of multiple DBs for better isolation and performance
databases 16
# DB 0: Rack::Attack rate limiting
# DB 1: Sidekiq jobs
# DB 2: Rails cache
# Multi-threaded I/O (Redis 6+) - improves throughput on multi-core
# Uncomment for production with Redis 6+
# io-threads 4
# io-threads-do-reads yes
# Replication (if needed in future)
replica-read-only yes
# Security
# requirepass will be set via environment variable in production
# Slow Log
# Log queries slower than 10ms
slowlog-log-slower-than 10000
slowlog-max-len 128
# Client Output Buffer Limits
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit replica 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
# Monitoring & Stats
# Track key space events for monitoring (use sparingly - has overhead)
# notify-keyspace-events Ex # Expired events only
# For full monitoring, use: notify-keyspace-events KEA
# Memory optimization
# Active defragmentation (Redis 4+) - helps with memory fragmentation
# activedefrag yes
# active-defrag-ignore-bytes 100mb
# active-defrag-threshold-lower 10
# active-defrag-threshold-upper 20
# active-defrag-cycle-min 5
# active-defrag-cycle-max 75
# Performance tuning
# Disable THP (Transparent Huge Pages) warning
# This should be done at OS level: echo never > /sys/kernel/mm/transparent_hugepage/enabled
# Redis will warn if THP is enabled
# Increase max clients if needed (default is 10000)
# maxclients 10000