As I understand the default load balancer using in Zuul proxy server as DynamicServerListLoadBalancer and it use ZoneAffinityServerListFilter rule to choose server. However, is there any way I can customize the loadbalancer used in zuul proxy server
I have tried to add following configuration to change to loadbalancer Rule:
eureka.client.NFLoadBalancerRuleClassName=com.netflix.loadbalancer.RoundRobinRule
But seems it still stick with default configuration.
Any advice is highly appreciated.
To change load balancing rule with configuration, you should define ribbon configuration like below.
your_ribbonclient_name.ribbon.NFLoadBalancerRuleClassName=com.netflix.loadbalancer.RoundRobinRule
your_ribbonclient_name
shoud be replaced with the proper one for your configuration. In Zuul, ribbon client name is same with service id for each route.
You can also provide your own IRule
bean for load balancing rule with @RibbonClient
like the following.
@RibbonClient(name = "your_ribbonclient_name", configuration = YourConfigurationClass.class)
You can find an example code here
If you want to apply your Ribbon config to whole ribbon clients in your server,
you can do that with @RibbonClients
(not @RibbonClient
).
@RibbonClients(defaultConfiguration = DefaultRibbonConfig.class)
You can find the example code here, and the related issues is here.