Replica load balance/randomize get_cmd

29 views
Skip to first unread message

Vincent Yau

unread,
Sep 24, 2020, 1:22:57 PM9/24/20
to lettuce-redis-client-users
Hello,

redis version: 5.0.6 (Cluster mode)
lettuce-core:5.2.1.RELEASE

1 master and 3 replicas
6 client hosts

Majority of our get_cmd traffic goes to one of the replicas, and it has been like this for the pass 7 days. Need some help here on how to get the load to distribute more evenly. Thanks.redis_get_cmd.png
Code to setup the lettuce client: 
ClusterTopologyRefreshOptions topologyRefreshOptions = ClusterTopologyRefreshOptions.builder()
     .enablePeriodicRefresh(60mins)
     .enableAllAdaptiveRefreshTriggers()
      .build();

ClusterClientOptions clientOptions = ClusterClientOptions.builder()
    .topologyRefreshOptions(topologyRefreshOptions)
    .build();

RedisClusterClient redisClusterClient = RedisClusterClient.create(uri);
redisClusterClient.setOptions(clientOptions);
redisClusterClient.setDefaultTimeout(timeout);

StatefulRedisClusterConnection<byte[], byte[]> connect = redisClusterClient.connect(new ByteArrayCodec());
connect.setReadFrom(ReadFrom.REPLICA);


Vincent Yau

unread,
Oct 14, 2020, 11:38:59 AM10/14/20
to lettuce-redis-client-users
Problem resolved by setting isOrderSensitive in ReadFrom to true.
Reply all
Reply to author
Forward
0 new messages