Search code examples
springspring-bootload-balancingspring-cloudspring-cloud-netflix

Spring Netflix LoadBalancing rules comparison


I have a question regarding to client-side load balancing with Spring-Cloud Netflix.

When load balancing is enabled, Ribbon will choose a server to be called. The choosing rule depends on IRule implementation which is chosen.

What is the difference between following implementations:

  • AvailabilityFilteringRule
  • BestAvailableRule
  • ClientConfigEnabledRoundRobinRule
  • RoundRobinRule
  • WeightedResponseTimeRule
  • ZoneAvoidanceRule

Thanks a lot


Solution

  • visit source for more info, and for different rules.

    RoundRobinRule This rule simply choose servers by round robin. It is often used as the default rule or fallback of more advanced rules.

    BestAvailableRule A rule that skips servers with "tripped" circuit breaker and picks the server with lowest concurrent requests.

    AvailabilityFilteringRule This rule will skip servers that are deemed "circuit tripped" or with high concurrent connection count.

    WeightedResponseTimeRule For this rule, each server is given a weight according to its average response time. The longer the response time, the less weight it will get. The rule randomly picks a server where the possibility is determined by server's weight.

    choose one using property

      service-id:
        ribbon:
          NFLoadBalancerRuleClassName: com.netflix.loadbalancer.AvailabilityFilteringRule