1

I am testing a spring-cloud eureka server and client. I have a simple question about the default configuration (server & client).

On the server side, the renew threshold is equal to 3. On the client side, it sends a heartbeat every 30 seconds (a maximum of 2 per minute).

When I look at the registry dashboard, when the waitTimeInMswhenSyncEmpty is over, I see the following warning message:

EMERGENCY! EUREKA MAY BE INCORRECTLY CLAIMING INSTANCES ARE UP WHEN THEY'RE NOT. RENEWALS ARE LESSER THAN THRESHOLD AND HENCE THE INSTANCES ARE NOT BEING EXPIRED JUST TO BE SAFE

When I look at the code, the test getNumOfRenewsInLastMin() <= numberOfRenewsPerMinThreshold is always true (2 <= 3)

Why is the default configuration, it seems weird because it constantly generates a warning!

If there is anyone who can give me an explanation. I think I've missed something…

miken32
  • 42,008
  • 16
  • 111
  • 154
stéphane
  • 11
  • 1
  • 3
  • I see `numberOfRenewsPerMinThreshold > 0 && getNumOfRenewsInLastMin() > numberOfRenewsPerMinThreshold`. which works out to `2 > 3 = false`. Where are you looking? https://github.com/Netflix/eureka/blob/a54991b8fe121bc39b2b1257b0c57f19ff0ccd30/eureka-core/src/main/java/com/netflix/eureka/registry/PeerAwareInstanceRegistryImpl.java#L465 – spencergibb Feb 03 '16 at 22:06
  • Could there be a problem between the method isBelowRenewThresold() (which is correct IMHO) and the FTL usage <#if isBelowRenewThresold>. Could it be that the FTL uses a method that returns a number where a boolean is expected? – Thomas Letsch Apr 07 '16 at 08:27
  • Sorry, please ignore my last answer. It seems to work correctly. My eureka console shows me that the renews (4) are indeed lower than the threshold (5). Since I have 2 clients, the renews will normally be 4. The big questionis, why the threshold is greater than the expected renews? This seems to be the case at this question here as well – Thomas Letsch Apr 07 '16 at 08:45

3 Answers3

2

I have the same problem and investigated it a little bit. The root cause for the warning message is that the renews are exactly 1 lower than the threshold.

It occurs when you start a plain eureka server and do not register any clients. It will get a 1 at the Renews threshold. When you now register a client, the 2 from the client are just added to the one that is already there. Thus making the Renews threshold now 3 and thats higher than the renews can ever get with one client. Wait a few minutes (about 4min) and the warning will appear.

My application.yml is:

spring:
  application:
    name: service-registry
server:
  port: 8761
eureka:
  instance:
    hostname: localhost
  client:
    registerWithEureka: false
    fetchRegistry: false
    serviceUrl:
          defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka/

I'm using Brixton.RC1.

Found two other SQ questions in the same topic:

Understanding Spring Cloud Eureka Server self preservation and renew threshold

Spring Eureka server shows RENEWALS ARE LESSER THAN THE THRESHOLD

Community
  • 1
  • 1
Thomas Letsch
  • 930
  • 1
  • 8
  • 15
0

Here are some details :

You could find the test allowing to display the message in this file below.

https://github.com/spring-cloud/spring-cloud-netflix/blob/master/spring-cloud-netflix-eureka-server/src/main/resources/templates/eureka/navbar.ftl

The value of the "isBelowRenewThresold" comes from the code below :

model.put("isBelowRenewThresold", registry.isBelowRenewThresold() == 1);

The invoked method can be found in the following file :

https://github.com/Netflix/eureka/blob/master/eureka-core/src/main/java/com/netflix/eureka/registry/PeerAwareInstanceRegistryImpl.java

Thank you for your help.

Regards, Stephane

stéphane
  • 11
  • 1
  • 3
0

Had the same problems, I tried this in application.properties.

eureka.client.lease.duration=10    
eureka.instance.leaseRenewalIntervalInSeconds=5    
eureka.instance.leaseExpirationDurationInSeconds=2 
Tiago Martins Peres
  • 14,289
  • 18
  • 86
  • 145