tarantool / vshard

The new generation of sharding based on virtual buckets
Other
100 stars 31 forks source link

router: add callro methods based on node zone #391

Open eugenepaniot opened 1 year ago

eugenepaniot commented 1 year ago

Pick a replica according prefered zone (highest priority replica zone) in round-robin manner.

Current callr* calls use only first replica. Current callbr* 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:

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 the priority_list by weight(actually relies on replica zone and zone_weights).

Serpentian commented 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:

eugenepaniot commented 1 year ago

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.