Lettuce created more than 1 native redis connection to redis cluster node #3127
Labels
for: team-attention
An issue we need to discuss as a team to make progress
status: waiting-for-triage
Current Behavior
In my env there are 40 redis cluster, each cluster has 20 master nodes and 20 replica nodes, so in total there are 1600 redis nodes. When my redis client application start up, there are 800+ redis connection on client side (observed by netstat), roughly 1 connection per redis master; but when the application workload is heavy , the connection number goes up to 7000+, on average there are 9 connection per one master node, and those connections never close.
There are multiple application instance on one server, I fear that if connection number increases indefinitly, tcp port could get exasted on the application server.
Java client code
The following code is used to create one redisTemplate for each redis cluster, since there are 40 cluster, so 40 redisTemplate are created in total.
Expected behavior/code
Based on this comment (#860 (comment)) the tcp connection per cluster is (2 * number of nodes) + 1, but this is not true in my ev, with 40X40 nodes, the connection number should be 40*((2 * 40) +1))=3240, but in my env there are 7000+ connections.
My Question
How many native Redis connections does Lettuce create to connect to a Redis cluster node? From what I understand, Lettuce shares native Redis connections between threads. However, in my environment, I observe that up to 10+ connections can be created per cluster node.
Is there something wrong in my code?
Or is this behavior configurable?
Environment
The text was updated successfully, but these errors were encountered: