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

LettuceClusterTopologyProvider does not use cached topology

Open abialas opened this issue 2 years ago • 1 comments

In JedisClusterTopologyProvider getTopology uses cached value for some time so it is better for performance and memory. In LettuceClusterTopologyProvider it is not done in the same way - always new value and topology are created.

Is it possible to somehow use cached value also in LettuceClusterTopologyProvider? When we are doing health checks often I see it impacts performance and memory heavily.

abialas avatar Feb 06 '23 10:02 abialas

The Lettuce integration uses the cached topology from the Lettuce RedisClusterClient object. Probably, you're referring to the repeated conversion from Lettuce objects to Spring Data Redis DTO's.

Lettuce updates the Partition object in place instead of creating new Partition objects. There's also no hashCode or equals method we could leverage to cache the converted objects.

This requires a bit more thought.

mp911de avatar Feb 06 '23 21:02 mp911de