Replies: 4 comments 2 replies
-
To add more to this investigation, I found that after changing my same code to use .get(key) instead of a custom command via dispatch(...) that the logs show LOWEST_LATENCY is being respected. Below is an example log: io.lettuce.core.cluster.PooledClusterConnectionProvider: getConnection(READ, 15413) |
Beta Was this translation helpful? Give feedback.
-
@mp911de Looking into the code, it seems that ReadOnlyCommands.java contains the hard-coded list of read-only commands. Given that the methods are It's also inconvenient that the |
Beta Was this translation helpful? Give feedback.
-
We just didn't had a good place to put these utilities in as there's no common package that contains code for multi-node operations. In any case, Something along the lines of an interface, that returns the With Redis Cluster working slightly different regarding pub/sub, we would pre-initialize The entire mechanism needs to be composable so that if one implementation cannot determine whether it is a read or a write command, then the next component in the chain would try to figure it out until we fall back to some default. With all these aspects in place, we should be able to develop a neat design. Let me know whether this helps. |
Beta Was this translation helpful? Give feedback.
-
With our rewrite, we would not check against |
Beta Was this translation helpful? Give feedback.
-
Hi there,
I am currently building a caching layer which uses Redis JSON as the value type. I am also intending to use the LOWEST_LATENCY ReadFrom field to help reduce network latency. I am using a custom Command, JSON.GET, with dispatch on my AdvancedRedisClusterCommands instance.
When I ran a basic test querying random keys, I noticed all requests are going to the primary node. After turning on debug logs, I noticed many logs lines like: io.lettuce.core.cluster.PooledClusterConnectionProvider: getConnection(WRITE, 6708). 6708 in this case represents a slot. Clearly, my command is being interpreted as a write and therefore, must go to the primary.
Digging deeper, I noticed a few things. 1) unless I have misread something, the ReadIntent logic skips ClusterCommands and defaults them to Writes; 2) even if a specific connection to a node is used, it uses a static set of Command names to determine if a command has ReadIntent. Of course, my command is not in that set.
Is anyone aware of a way to execute my command with READ intent while also leveraging the LOWEST_LATENCY functionality in cluster mode?
Sorry if any of this is inaccurate or unclear. I've been at this for awhile. Thanks in advance.
Beta Was this translation helpful? Give feedback.
All reactions