Redis is critical for ERPNext performance. It handles caching, real-time updates, and background job queuing. Poorly configured Redis can make your ERPNext instance slow and unresponsive. This guide covers how to tune Redis for production use.

How ERPNext Uses Redis

ERPNext uses three separate Redis instances:

redis-cache   (port 13000) - Page and query caching
redis-queue   (port 11000) - Background job queue (RQ)
redis-socketio (port 12000) - Real-time notifications

STEP 1 Find Redis Config

# System Redis config
sudo nano /etc/redis/redis.conf

# ERPNext-specific Redis configs (auto-generated)
ls frappe-bench/config/
# redis_cache.conf
# redis_queue.conf
# redis_socketio.conf

STEP 2 Tune Memory Settings

Edit the cache Redis config for your bench:

nano frappe-bench/config/redis_cache.conf
# Set max memory (adjust based on your server RAM)
maxmemory 512mb

# Eviction policy - remove least recently used keys when full
maxmemory-policy allkeys-lru

# Save to disk less frequently (cache can be rebuilt)
save ""

STEP 3 Tune Queue Redis

nano frappe-bench/config/redis_queue.conf
# Queue data must persist
maxmemory 256mb
maxmemory-policy noeviction

# Keep saving to disk
save 900 1
save 300 10
save 60 10000

STEP 4 Monitor Redis

# Check memory usage
redis-cli -p 13000 INFO memory

# Check connected clients
redis-cli -p 13000 INFO clients

# Monitor real-time commands
redis-cli -p 13000 MONITOR

# Check queue length
redis-cli -p 11000 LLEN default

STEP 5 Restart Redis

bench setup redis
sudo supervisorctl restart all

Troubleshooting

# If Redis is using too much memory
redis-cli -p 13000 FLUSHALL

# If background jobs are stuck
redis-cli -p 11000 FLUSHALL
bench --site mysite.local clear-cache

# Check if Redis is running
redis-cli -p 13000 PING
# Should return: PONG

Properly configured Redis makes a noticeable difference in ERPNext responsiveness. Page loads are faster, background jobs process quicker, and real-time updates work smoothly.

Share this article

Comments

Join the discussion. Got a question, found an issue, or want to share your experience?

Leave a Comment

Your email stays private. We just use it for replies.

Nothing to preview yet.

Use **bold**, *italic*, `code`, ```code blocks```, [link](url), > quote, - list