Too many connections opened if RedisClusterConfiguration used [DATAREDIS-1206]
j-razeed opened DATAREDIS-1206 and commented
We are planning to use elasticache redis for our spring boot application.
I created elasticache redis cluster (3 shards and 2 replica per shard. so total 9 nodes.) In my spring boot application. I have created connectionFactory like below:
List<String> nodes = Collections.singletonList(hostName + ":" + port);
RedisClusterConfiguration configuration = new RedisClusterConfiguration(nodes);
return new LettuceConnectionFactory(configuration);
where hostname and port number is elasticache's endpoint.
The problem is, when I run my application with full load, I see too many new connections are created and closed immediately. I.e., over a period of time, I can see 25 connections in ESTABLISHED state and 32000 connections in TIME_WAIT state. This is affecting performance.
Whereas, when I create elasticache redis (no cluster) single node with 2 replica. Created connectionFactory as below:
return new LettuceConnectionFactory(hostName, port);
I can clearly see only one connection is in ESTABLISHED state and performance also considerably good.
Why RedisClusterConfiguration is not reusing the connections?
Application developed with Spring Boot 1.5.9; Spring-data-redis 1.8.9 and lettuce 4.5.0
No further details from DATAREDIS-1206
j-razeed commented
I got a response in the forum https://stackoverflow.com/questions/51851093/how-to-fix-low-lettuce-client-performance-with-redis-cluster-elasticache?noredirect=1#comment112378876_51851093. After upgrading to Spring-boot 2, there is no performance issue. Hence closing this ticket