-
Notifications
You must be signed in to change notification settings - Fork 957
Description
Problem/Use-case:
As we know that single key command << pipelining <<< multi key command to write/read n key from Redis, and to leverage this multi key command on Redis to get the higher ops we can enable cross slot command execution only if all multi key are owned by executing shard (not involving multiple shards for single multi key command).
Description:
Introduce a new configuration option in redis.conf, enable-cross-slot, which defaults set to no but can be set to yes when running Redis in cluster mode.
This feature enables cross-slot command execution if keys are owned by single shards.
Design:
Client: Already aware about slot range owned by each shard of Redis cluster and update with multiple topology refresh strategy.
To execute n key multi-key command, client groups this into K commands with hash ranges owned by each shards. (K is number of shards in cluster)
Then client async executes these multi key commands and join and return.
Since In above multiple nodes are involved to execute multi-key command, so their execution is not guaranteed to be atomic (so, they can actually break the atomic design of many Redis commands).
For that we can add a new config in redis.conf enable-cross-slot yes (by default no) and only considered when running Redis in cluster mode. {similar to Redis Proxy: https://github.com/RedisLabs/redis-cluster-proxy}
Alternatives Considered:
Leveraging Redis Proxy: Utilizing existing Redis Proxy solutions like https://github.com/RedisLabs/redis-cluster-proxy can mitigate the issue but adds another layer of complexity to the architecture.
Manual grouping of multi-key commands by the client based on hash slots: Given Redis's extensive 16K+ hash slots, users typically issue multi-key commands involving 10 or 100 keys. However, grouping these keys by hash slots often results in nearly single or double key multi-get commands. Unfortunately, this approach doesn't significantly enhance performance.
Additional Information:
With enable-cross-slot set to yes, Redis will ensure atomic execution of multi-key commands in individual shards, enhancing the reliability and consistency of operations.
Clients must be aware of the slot ranges owned by each shard in the Redis cluster and update their topology accordingly to leverage this feature effectively.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status