I'm currently facing an issue where Eureka never clears out service instances that have become stale because a VM went down unexpectedly. Understandably, Eureka's self-preservation mode kicked in because there was a large drop (below the threshold) in service renewals/heartbeat requests. However, 15+ hours later the dead instances are still registered in Eureka. This is a major problem as service requests continue to be directed to the dead instances only to return errors.
My hope was that the threshold is continuously adjusted and after some period of time, Eureka's threshold would be at a new norm level and self-preservation mode would be reset. We are using Eureka in mirrored setup and our configurations are not very complex.
Our setup:
Eureka via spring-boot-starter-parent 1.2.5.RELEASE
eureka:
dashboard:
path: services
enabled: false
instance:
hostname: localhost
leaseRenewalIntervalInSeconds: 3
metadataMap:
managementPath: /admin
instanceId: discoveryPrimary
client:
registerWithEureka: false
fetchRegistry: false
serviceUrl:
defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka/
server:
waitTimeInMsWhenSyncEmpty: 0
Is it possible to adjust Eureka configurations to reset the self-preservation mode (where it stops clearing instances) and allow it to clear service registries if the services are dead for 5+ minutes?
renewalPercentThreshold
will get around the issue by delaying self-preservation mode. We can accomplish the same by settingeureka.server.enableSelfPreservation=false
, but that still won't solve the issue if self-preservation is triggered and those instances never come back. – Arlinda