Redis: max number of clients reached
Redis: max number of clients reached
DodaTech
2 min read
The error “Redis: max number of clients reached” means the Redis server has accepted the maximum number of concurrent client connections defined by the maxclients configuration directive.
What It Means
Redis has a hard limit on simultaneous client connections, controlled by the maxclients setting (default 10,000 in most configurations). When the limit is reached, Redis rejects new connections with this error. Existing connections continue to work normally.
Why It Happens
- Your application creates too many connections without reusing them.
- The connection pool size is too large for the application instance count.
- A previous application instance crashed without closing its Redis connections.
- Redis is shared across multiple services and the combined connection count exceeds the limit.
- The operating system’s file descriptor limit (
ulimit -n) is lower thanmaxclients. - Stale connections from a load balancer or proxy are accumulating.
How to Fix It
1. Check the current client count
redis-cli CLIENT LIST | wc -l
redis-cli INFO clients2. Increase maxclients
redis-cli CONFIG SET maxclients 20000To make it permanent, edit /etc/redis/redis.conf:
maxclients 200003. Increase the OS file descriptor limit
ulimit -n 65536
sudo nano /etc/security/limits.confAdd:
redis soft nofile 65536
redis hard nofile 655364. Kill idle or stale connections
redis-cli CLIENT KILL TYPE normal5. Optimize connection pooling in your application
# Python example with redis-py
import redis
pool = redis.ConnectionPool(max_connections=50)
r = redis.Redis(connection_pool=pool)FAQ
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro