spring-data-redis icon indicating copy to clipboard operation
spring-data-redis copied to clipboard

Too many connections opened if RedisClusterConfiguration used [DATAREDIS-1206]

Open spring-projects-issues opened this issue 5 years ago • 1 comments

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

spring-projects-issues avatar Aug 21 '20 16:08 spring-projects-issues

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

spring-projects-issues avatar Sep 06 '20 12:09 spring-projects-issues