spring-projects / spring-data-redis

Provides support to increase developer productivity in Java when using Redis, a key-value store. Uses familiar Spring concepts such as a template classes for core API usage and lightweight repository style data access.
https://spring.io/projects/spring-data-redis/
Apache License 2.0
1.77k stars 1.17k forks source link

Keyspace Events in Redis Cluster get lost [DATAREDIS-534] #1111

Open spring-projects-issues opened 8 years ago

spring-projects-issues commented 8 years ago

Mark Paluch opened DATAREDIS-534 and commented

Keyspace notifications in Redis Cluster are published only to the local node (see https://github.com/antirez/redis/issues/2541. Keyspace notifications are not broadcasted to all nodes).

Spring Data Redis subscribes only to one (random) node and so the expiry event may be received but that depends on which node the subscription resides and on which cluster node a key expired.

The recommended workaround is to:

  1. Subscribe to all master nodes
  2. Periodically check for topology changes
  3. Handle (merge) events on the client

Affects: 1.7.2 (Hopper SR2)

Issue Links:

2 votes, 3 watchers

kinsersh commented 8 months ago

I'm seeing this same issue as reported with https://github.com/spring-projects/spring-session/issues/2230. In my use case, it negatively affects Spring Authorization Server when using SpringSessionBackedSessionRegistry with a sharded redis where the authorization server's token endpoint ends up reading every session including the expired ones in the principal index. The expired sessions stack up which linearly increases the token endpoint latency.

sureshkmit commented 1 week ago

Any update on this issue? This is a blocker for us. We used Redis Repository pattern with search capabilities without knowing about this issue.