Closed tanner0101 closed 6 years ago
I think pooling would only be useful with pub/sub or blocking commands, which is probably not the most common scenario. It would be nice if this was opt in, so it doesn't exhaust connection limits on cloud providers.
Exhausting connection limits on cloud providers is actually what I was worried about. I use Redis to store session tokens and I don't my whole massive setup to come down just cause the caching service is out of connections (and is only used on session lookup). I see what you're saying though. I'd love to see a middleground
Maybe we can have it configurable such that if you set max connections to ‘nil’ it will just create a new connection each time. Note also the connection pooling is for the KeyedCache impl. Creating a Redis client manually will not be affected by this.
I don't see a reason to pool redis connections since they support pipelining. There's little to no performance gain. Actually, I think it'll worsen the performance very slightly.
Yeah the only way I see it being useful is for blocking commands. I believe blocking commands put the client in a blocked state and the client is unable to send or receive other commands until that blocking call returns or times out.
I agree, but we don't support blocking operations in the Redis Client. We have a separate static method for setting up a blocking client for pub/sub.
I see, creating a new RedisClient instance for those commands makes more sense anyways. The only problem I see is there is no way to send commands before subscribe is sent, like AUTH or SELECT for instance.
Fixed by #95
Allow connections to be pooled and re-used.