Open eugenepaniot opened 1 year ago
Thanks for the patch! Looks great! Please get acquainted with code review procedure and make sure your PR comply with our styling rules. For example:
router: add callro methods based on node zone
. The commit message should explain why and what you did;Sorry, very busy now to implement tests. Will try to do it soon. It will be very helpful if someone from QA Team helps with it. Thank you.
Pick a replica according prefered zone (highest priority replica zone) in round-robin manner.
Current
callr*
calls use only first replica. Currentcallbr*
calls use replicas in round-robin manner only, without zonal preferences that leads to extra cross zonal traffic (that costs some pennies) and higher latency.Current PR suggests two new methods and new load-balancing (replica selection) algorithm:
callbro
- prefer, but not limit, Inner zone balanced method with round-robin;callbre
- but prefer, but not limit, Inner zone balanced method with round-robin;The algorithm is quite simple but useful, it resets round-robin cursor
balance_i
into the main position (1
- highest priority replica) when reches the last replica in the same zone. It is possible as all replicas already sorted in thepriority_list
byweight
(actually relies on replicazone
andzone_weights
).