You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a redis cluster of 3 master nodes & 6 slave nodes. There is a key named "a" on 1 master node and 2 slave nodes. I set ReadFrom = SLAVE and try to read the "a" key from both of the 2 slave nodes in concurrently rest calls. However, when I use jmeter to call the "test" API with 10 threads, only one of the 2 slave processes has high cpu rate while the other one seem to be idle. Am I missing some config here, or is lettuce designed to read from only one slave node, even when the ReadFrom.SLAVE option is used?
Current Behavior
Only one slave node has high cpu rate.
Input Code
private RedisClusterClient client;
private StatefulRedisClusterConnection<String, String> connection;
private GenericObjectPool<StatefulRedisClusterConnection<String, String>> pool;
@RequestMapping("/lettuce-init/{ip}/{port}")
public void lettuceOpen(@PathVariable String ip, @PathVariable int port) throws Exception {
client = RedisClusterClient.create(RedisURI.create(ip, port));
connection = client.connect();
connection.setReadFrom(ReadFrom.SLAVE);
pool = ConnectionPoolSupport.createGenericObjectPool(() -> connection, new GenericObjectPoolConfig());
}
@RequestMapping("/test")
public String lettuce() throws Exception {
StatefulRedisClusterConnection<String, String> conn = pool.borrowObject();
String result = conn.sync().get("a");
conn.close();
log.debug(result);
return result;
}
Expected behavior/code
All slave nodes receive roughly equal amount of requests.
Environment
Lettuce version(s): 5.1.7
Redis version: 5.0.5
The text was updated successfully, but these errors were encountered:
Works as designed. See #834 for details. Once #1145 is fixed, you can create your own ReadFrom implementations that can randomize load. Use ReadFrom.ANY until then.
@mp911de Is this feature available now ? I am using 5.2.2.RELEASE, can't see there at least. I also have same usecase where I have multiple SLAVES and I want to distribute read between those nodes.
Bug Report
I have a redis cluster of 3 master nodes & 6 slave nodes. There is a key named "a" on 1 master node and 2 slave nodes. I set ReadFrom = SLAVE and try to read the "a" key from both of the 2 slave nodes in concurrently rest calls. However, when I use jmeter to call the "test" API with 10 threads, only one of the 2 slave processes has high cpu rate while the other one seem to be idle. Am I missing some config here, or is lettuce designed to read from only one slave node, even when the ReadFrom.SLAVE option is used?
Current Behavior
Only one slave node has high cpu rate.
Input Code
Expected behavior/code
All slave nodes receive roughly equal amount of requests.
Environment
The text was updated successfully, but these errors were encountered: