How can you customize Ribbon’s load-balancing strategy in a Spring Cloud application?

  • By configuring the ribbon.strategy property in application.properties.
  • By implementing a custom IRule and configuring it as a bean.
  • By using the @LoadBalanced annotation on RestTemplate.
  • By setting the ribbon.loadBalancer property in the service configuration.
In a Spring Cloud application, you can customize Ribbon's load-balancing strategy by implementing a custom IRule and configuring it as a bean. Ribbon uses IRule to determine which instance to route a request to. By creating a custom IRule, you can define your own load-balancing logic. The other options are not used to customize Ribbon's load-balancing strategy. The @LoadBalanced annotation is used to enable client-side load balancing with RestTemplate. The ribbon.strategy and ribbon.loadBalancer properties are not used for customizing the load-balancing strategy directly.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *