linkedin / rest.li

Rest.li is a REST+JSON framework for building robust, scalable service architectures using dynamic discovery and simple asynchronous APIs.
rest.li
Other
2.51k stars 546 forks source link

Optimize affinity routing while making use of DISTRIBUTION_BASED consistent hash algorithm #763

Closed maulinpatel007 closed 2 years ago

maulinpatel007 commented 2 years ago

Added solution for optimizing affinity routing. Today existing affinity routing solution seems to be CPU or memory heavy and can only be enabled by POINT_BASED or MULTI_PROBE consistent hash algorithm.

This PR provides lightweight solution to achieve affinity routing while making use of DISTRIBUTION_BASED consistent hash algorithm.

Using this solution, applications can choose to optimize Affinity routing by providing implementation to AffinityRoutingUriProvider interface implementation and supply the instance in RequestContext's local attribute.