Details
-
Improvement
-
Status: Open
-
Major
-
Resolution: Unresolved
-
None
Description
Currently, client uses primary replicas for partition awareness:
- Get primary replica per partition from server (Map<Partition, Replica>)
- Compute target replica from key
- If a direct connection exists to that replica, use it. Otherwise, use any other connection.
We can improve performance for certain requests (RO transactions) by using non-primary replicas as well:
- Get all replicas per partition from server (first = primary) (Map<Partition, List<Replica>>)
- Compute target partition from key
- Iterate over the list of replicas in original order to find an active direct connection
In other words, "use primary replica if possible, otherwise use non-primary replica, otherwise use any connection".