I wrote a simple Spring Cloud Ribbon application, to call a REST service which was registered in Eureka.
But how to override the ribbon.serverListRefreshInterval
value? The default value is 30 seconds, I'd like to reduce the time interval.
Thanks in advance.
@codependent
After put below configuration in application.yml, it looked the configuration didnt take effect.
I observed that the instances list has been updated in Ribbon side (through eureka.client.registry-fetch-interval-seconds parameter), however Ribbon still point out a dead instance:
192.168.1.101:Compute-Service:1111 was right service instance, while 192.168.1.101:Compute-Service:2222 was dead instance, obviously Ribbon still pointed to the dead instance, which meant Ribbon ServerList cache was not refreshed.
Try with:
where
myService
is the name of your destination microservice.UPDATE:
After some source code digging I found out that
LoadBalancerBuilder
calls:whose super is:
Notice the
PollingServerListUpdater
constructors:The second one would allow us to override the default refresh interval. However it's the first one that's called, so it ignores de property.
UPDATE 2:
There's an open issue about this: https://github.com/spring-cloud/spring-cloud-netflix/issues/1304