Skip to content

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

Open
@sureshkmit

Description

@sureshkmit

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions