Closed jstorm31 closed 3 years ago
@jstorm31 Pooling is done under the hood in Vapor 4.
Each EventLoop
is given an RedisConnectionPool
, so if your configuration says to populate a pool with 4 connections, and you have 4 EventLoop
s, then you will have 16 total connections.
Try modifying the configuration with app.redis.configuration.pool
.
In the next week or so, documentation will improve as Vapor/Redis moves to full 4.0 release
I see, thank you 🙂
I'm hosting my server on Heroku free Dyno and I've been getting
(Redis) ERR max number of clients reached
recenty.I've found out it could be solved either by setting a shorter timeout on Heroku or connection pooling. There was a method for pooling in Vapor 3
req.withPooledConnection(to: .redis)
, but I haven't found such a method in Vapor 4, so I use directlyreq.redis.anyCommand(...)
.My questions:
EDIT: When I checked the Redis Heroku dashboard, there were 16 - 20 clients connected and never disconnected. I wonder how is that possible. 🤔 Nevertheless, I could kill all connections from Redis site with Heroku cli
heroku redis:cli
and runningCLIENT KILL TYPE normal
. I think that won't fix the problem though.