How to write/override own key slot hashing algoritm in lettuce ?

128 views
Skip to first unread message

sagars...@gmail.com

unread,
Apr 22, 2019, 10:17:18 AM4/22/19
to lettuce-redis-client-users
how to write/override own key slot hashing algoritm in lettuce?

I have 500 keys of which 100 keys's value is large in volume/size. Issue that I am facing is one of my 3 shard is utilizing 10 gb data and other 2 shards are using 1 gb each.
I want to  distrubute big size keys equally across shards for which I believe I need to override existing hashslot alogrithm.

Can someone help me how to do that?

Mark Paluch

unread,
Apr 23, 2019, 4:49:04 AM4/23/19
to lettuce-redis-client-users
This is not a Lettuce issue, this is a Cluster configuration/sharding issues. Redis requires the client to compute a slot hash and then clients determine a shard by the calculated slot hash. If the client would route a command to a different shard, then Redis rejects execution and redirects to the appropriate shard.

The only things to do are: Reconfigure your cluster or use slot hash tags enclosed in {…}. See Redis docs for further details.

Cheers, 
Mark

Sagar Sitap

unread,
Apr 23, 2019, 7:54:44 AM4/23/19
to Mark Paluch, lettuce-redis-client-users
Yup this is not Lettice issue. I want to know if there is a way by which slot hash calulation algorithm can be overriden in lettuce. 
As you said clients (lettuce in this case) determine a shard by the calculated slot hash, is there a way?

yeah I checked slot hash tags, it will make sure same hash tags keys will go in same shards but that will not solve my problem.
E.g. 
hash tags = "aa"  suppose there are 4 keys of each 10 mb data so 40 mb total goes in shard 1
hash tags = "bb" for this hash tag it is possible that redis end up putting keys in same shard as above.

please correct me if I am wrong





--
You received this message because you are subscribed to a topic in the Google Groups "lettuce-redis-client-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/lettuce-redis-client-users/lp7Nrc4HYD8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to lettuce-redis-clien...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lettuce-redis-client-users/b78a2687-df82-41fc-9374-589bc4289281%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
Thanks,
Sagar Sitap
Reply all
Reply to author
Forward
0 new messages