2

I'm using Spring, Eureka and Ribbon. I want to change the refresh interval for ribbon. While reading the documentation, I found out that I should set the following property:

my-service.ribbon.ServerListRefreshInterval=99999

However, it doesn't help because when I create a load balancer, Spring uses the following constructor

   public DynamicServerListLoadBalancer(IClientConfig clientConfig, IRule rule, IPing ping, 
        ServerList<T> serverList, ServerListFilter<T> filter) {
    this(
            clientConfig,
            rule,
            ping,
            serverList,
            filter,
            new PollingServerListUpdater()
    );

And this constructor doesn't use my property.

g00glen00b
  • 41,995
  • 13
  • 95
  • 133

1 Answers1

2

I had a look at this topic : How to override the ribbon.serverListRefreshInterval default value in Spring Cloud Ribbon?

The problem is related to this bug : ribbon.ServerListRefreshInterval ignored #1304.

The bug has been solved in spring-cloud-netflix 1.3.0.RC1 on March 2017 .

You are using Spring Cloud Camden.SR7 which uses Spring Cloud Netflix 1.2.7.RELEASE, where the bug wasn't fixed yet.

Either force the use of spring-cloud-netflix 1.3.0 or above, or switch to a Spring Cloud version that contains this kind of dependency, e.g Spring Cloud Edgware.SR2 (Maven repo) which uses Spring Cloud Netflix 1.4.3.RELEASE

Arnaud
  • 17,229
  • 3
  • 31
  • 44
  • Thank you. It's help me, but now the clientConfig doesn't see my-service.ribbon.ServerListRefreshInterval property? Can you help with this problem? I can fix it with use ConfigurationManager.loadPropertiesFromResources("sample-client.properties"); but I think that this is not a good way – Иван Гладуш Feb 20 '18 at 14:30
  • Sorry I have no clue why your properties aren't found. – Arnaud Feb 20 '18 at 14:52
  • Maybe you could try a version of Spring Cloud nearest to Camden.SR7, maybe Dalston.RELEASE (Maven : https://mvnrepository.com/artifact/org.springframework.cloud/spring-cloud-starter-parent/Dalston.RELEASE) which uses Spring Cloud Netflix 1.3.0 : https://spring.io/blog/2017/04/12/spring-cloud-dalston-released – Arnaud Feb 20 '18 at 15:01