Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use client consistent hashing with Lettuce Redis client

I'm trying to find references how to configure and use Lettuce Redis client with client-side consistent hashing.

This approach for a sharding is implemented in ShardedJedis from Jedis client and described in the Redis partitioning documentation.

Short description of the approach: We have an environment with multiple independent Redis processes/nodes, without any server-based request routing using Redis Cluster or Sentinel, and a client decides where to store/search key by applying a hash function (key -> node_id) on the client side.

Does lettuce support this type of clustering/sharding out of the box? If yes, how it could be configured to use client hashing?

like image 438
Dmitry Spikhalskiy Avatar asked Sep 11 '25 06:09

Dmitry Spikhalskiy


1 Answers

TL;DR

There's no built-in support for sharding in Lettuce besides Redis Cluster.

Longer Response

Lettuce has support for fundamental Redis features. It supports Redis Standalone, Redis Cluster, Redis Sentinel and as of Version 4.x Master/Slave (which is a read routing layer on top of Redis Standalone) operating modes. All the other proposals and possibilities that could be built on top of Redis are not part of Lettuce.

Lettuce focuses on core Redis features to be a scalable and resilient client providing transport guarantees to your application. You could build that support yourself if you're interested in doing so.

Lettuce is kept extensible with the idea of allowing extensions to be built on top of AbstractRedisClient (support for client facades and connection procedures), RedisChannelHandler(the connection facade itself) and RedisChannelWriter (an abstract writing facade that can be used for node-routing).

like image 91
mp911de Avatar answered Sep 12 '25 19:09

mp911de