Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add possibility to configure expected interval between clients' renew… #1093

Merged
merged 3 commits into from
Jul 17, 2018

Conversation

mgtriffid
Copy link
Contributor

…s and not break self-preservation

Currently, if one sets renewal interval different from 30 seconds on clients, self-preservation doesn't work correctly. For example, see spring-cloud/spring-cloud-netflix#373 . This PR adds possibility to configure expected renewal interval on Eureka server, so that if clients send renews every, say, 20 seconds, then SP threshold is 0.85 * 3 * count, not 0.85 * 2 * count.

@holy12345
Copy link
Contributor

@mgtriffid Thanks your PR : )
Tiny things.
Could you please add some validate about serverConfig.getExpectedClientRenewalIntervalSeconds() is not zero.

@neoremind
Copy link
Contributor

neoremind commented Jul 5, 2018

I think there might be a more aggressive solution to make heartbeats interval configurable. Because there are too many hard code by / 2 in class AbstractInstanceRegistry and PeerAwareInstanceRegistryImpl, if we set so then there is no need to add this parameter.

Copy link
Contributor

@qiangdavidliu qiangdavidliu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mgtriffid the PR mostly looks good, thanks. I think you may need to make a change here too:
https://github.com/Netflix/eureka/blob/master/eureka-core/src/main/java/com/netflix/eureka/registry/PeerAwareInstanceRegistryImpl.java#L294

Also, please address @holy12345 's comment and add some safeguards to the config. Thanks.

this.numberOfRenewsPerMinThreshold =
(int) (this.expectedNumberOfRenewsPerMin * serverConfig.getRenewalPercentThreshold());
(int) (this.expectedNumberOfClientsSendingRenews
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This computation is repeated three times and might be better moved to a central method.

@mgtriffid
Copy link
Contributor Author

mgtriffid commented Jul 11, 2018

I think you may need to make a change here too:
https://github.com/Netflix/eureka/blob/master/eureka-core/src/main/java/com/netflix/eureka/registry/PeerAwareInstanceRegistryImpl.java#L294

Sorry, I don't get it what do these two minutes mean. This seems to be an expiration check, but it uses lease duration and last lease renewal, and I can't understand why do we need to add 2 minutes. Could you kindly explain, @qiangdavidliu ?

Addressed other comments.

@qiangdavidliu
Copy link
Contributor

@mgtriffid no worries, that was a minor issue. Thank you for the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants