spring-projects / spring-projects/spring-data-redis

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

Open
#3,079 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status: feedback-provided
Dominant language
Java
Stars
1.9k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Spring Data Redis repository pattern and its cluster-mode behavior described in the linked cluster documentation. Trace how repository index keys and entity keys are generated, then verify that index keys share one slot while entity keys use the default cluster hash distribution; the issue is done when repository operations such as SINTER and SUNION still work server-side.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, redis, spring
Domain
backend, databases
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.