Skip to content

JedisClusterKeyCommands makes extra KEYSLOT calls to the server #2156

Closed
@upthewaterspout

Description

@upthewaterspout

In JedisClusterKeyCommands, most of the commands find the node for a key using connection.getTopologyProvider().getTopology().getKeyServingMasterNode(key). However, there are a few commands like restore that call connection.clusterGetNodeForKey.

clusterGetNodeForKey actually ends up making a call to the redis server to execute the CLUSTER KEYSLOT command to determine the slot for the key. This is inefficient because it requires an extra round trip to the server to compute the slot of the key.

I can't see any particular reason why these commands are not calling getKeyServingMasterNode. That method computes the slot for the key on the client side, which is more efficient.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions