You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We've been bumped into Redis performance issue recently, due to too many REDIS KEYS commands were requested.
Thousands of KEYS commands were sent to Redis server, while our codes never use KEYS command directly.
My college found that KEYS command came from DefaultRedisCacheWriter.clean method. byte[][] keys = Optional.ofNullable(connection.keys(pattern)).orElse(Collections.emptySet()) .toArray(new byte[0][]);
My question is: Is there an option to switch it to Redis SCAN method? Or I have to resort to a customized RedisCacheWriter?
A while loop of SCAN usually takes client more time to complete, so it is actually still a less-satisfactory solution. The advantage is SCAN method will not block REDIS server for long.
Cache clearing may be performed in an asynchronous fashion, while the DefaultRedisCacheWriter goes for synchronous way, it therefore blocks both client and Redis Server, with the advantage that subsequent lookups won’t be seeing the cache entries any more.
We've been bumped into Redis performance issue recently, due to too many REDIS KEYS commands were requested.
Thousands of KEYS commands were sent to Redis server, while our codes never use KEYS command directly.
My college found that KEYS command came from DefaultRedisCacheWriter.clean method.
byte[][] keys = Optional.ofNullable(connection.keys(pattern)).orElse(Collections.emptySet()) .toArray(new byte[0][]);
My question is: Is there an option to switch it to Redis SCAN method? Or I have to resort to a customized RedisCacheWriter?
A while loop of SCAN usually takes client more time to complete, so it is actually still a less-satisfactory solution. The advantage is SCAN method will not block REDIS server for long.
Cache clearing may be performed in an asynchronous fashion, while the DefaultRedisCacheWriter goes for synchronous way, it therefore blocks both client and Redis Server, with the advantage that subsequent lookups won’t be seeing the cache entries any more.
Version: spring-boot, 2.3.3, spring-data-redis, 2.3.3.
The text was updated successfully, but these errors were encountered: