Skip to content
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 than maxclients.
  • 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 clients

2. Increase maxclients

redis-cli CONFIG SET maxclients 20000

To make it permanent, edit /etc/redis/redis.conf:

maxclients 20000

3. Increase the OS file descriptor limit

ulimit -n 65536
sudo nano /etc/security/limits.conf

Add:

redis soft nofile 65536
redis hard nofile 65536

4. Kill idle or stale connections

redis-cli CLIENT KILL TYPE normal

5. 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

What is the default maxclients value in Redis?
The default is usually 10,000, but it depends on the ulimit -n value. Redis sets maxclients to ulimit - 32 at startup. You can check with CONFIG GET maxclients.
How do I find which application is consuming the most connections?
Use redis-cli CLIENT LIST to see all connected clients with their addresses, names, and idle times. Group by IP to identify the heaviest consumer: redis-cli CLIENT LIST | awk '{print $2}' | sort | uniq -c | sort -rn.

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro