Skip to content

CROSSSLOT Keys in request don't hash to the same slot #3007

Open
@shubsaini09

Description

@shubsaini09

Description

I want to insert 50k records everyday as a batch operation. I thought MSET or pipeline is the best option but i got an error CROSSSLOT Keys in request don't hash to the same slot. After some research i got to know that mset or pipeline stores in same hash slots. This is done by adding something constant {} in the key.

I want to use MSET or pipeline to get that performance while setting the keys but also store on different hash slots.

I also came across ioredis package which helps in writing to different slots using pipeline. I have not tried because i wanted to stick to official package.

Also, since my Redis cache is serverless, does it really matter whether the data is stored in the same hash slot or spread across different ones? I assume AWS handles this internally now. However, if I were managing a Redis cluster myself, slot distribution would matter—because sending all data to a single slot could create a hotspot and lead to CPU bottlenecks.

I am using AWS Redis Serverless 7.1
I am using node-redis 4.6.13 library to do above.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions