Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Repository Pattern] Pin keyspaces to single slot only for index keys on cluster mode #3079

Open
sureshkmit opened this issue Dec 17, 2024 · 2 comments
Labels
status: feedback-provided Feedback has been provided

Comments

@sureshkmit
Copy link

sureshkmit commented Dec 17, 2024

Spring Data Redis repository pattern can confine only index keys within a single Redis slot when operating in cluster mode. Entity keys can be distributed across multiple slots as per the cluster's default hash algorithm. Commands (such as SINTER and SUNION) can still be processed on the server side as all involved index keys map to the same slot. Distributing entity keys across multiple Redis slots in a cluster environment can reduce hot spots and improved scalability and performance.

https://docs.spring.io/spring-data/redis/reference/redis/redis-repositories/cluster.html

Example
NOTE: Curly brace only on index keys.

Key Type Slot Node
people:e2c7dcee-b8cd-4424-883e-736ce564363e id for hash 15171 127.0.0.1:7379
people:a9d4b3a0-50d3-4538-a2fc-f7fc2581ee56 id for hash 7373 127.0.0.1:7379
{people}:firstname:rand index 2399 127.0.0.1:7379
{people}:firstname:mike index 2399 127.0.0.1:7379
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Dec 17, 2024
@sureshkmit sureshkmit changed the title [Spring Data Redis Repository Pattern] Pin Keyspaces to single slot only for index keys on cluster mode. [Repository Pattern] Pin keyspaces to single slot only for index keys on cluster mode Dec 18, 2024
@christophstrobl
Copy link
Member

If you would like us to spend some time helping you to diagnose the problem, please spend some time describing it. Right now, we struggle to understand what you want to achieve.

@christophstrobl christophstrobl added status: waiting-for-feedback We need additional information before we can continue and removed status: waiting-for-triage An issue we've not yet triaged labels Dec 18, 2024
@sureshkmit
Copy link
Author

Our current implementation utilizes the repository pattern to cache millions of objects, with indexing enabled on specific attributes. By confining all keys to a single Redis slot, we're effectively centralizing all data within a single shard. This approach negates the benefits of Redis Cluster mode, as horizontal scaling across multiple shards is hindered. To leverage the full potential of Redis Cluster, the library should distribute the objects data across the cluster. I believe restricting index keys to a single slot is adequate.

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: feedback-provided Feedback has been provided
Projects
None yet
Development

No branches or pull requests

3 participants