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

Optimize the update of the earliestReadmitTime in the Managed Network #719

Closed
bamzedev opened this issue Mar 17, 2023 · 1 comment
Closed
Labels
enhancement New feature or request
Milestone

Comments

@bamzedev
Copy link
Contributor

Problem

Currently, the earliestReadmitTime in the ManagedNetwork is updated on every call to the _ReadmitNodes() method. This can be inefficient as it goes through all nodes in the network, even if none are expected to be readmitted in the near future.

To improve performance, we have optimized the update of the earliestReadmitTime in the following way:

When iterating over the unhealthy nodes, keep track of the next earliest readmit time.
Update earliestReadmitTime only if the next earliest readmit time is less than the current earliestReadmitTime.
If no unhealthy nodes are present, set the earliestReadmitTime to now.Add(this.minNodeReadmitPeriod).
This optimization reduces unnecessary iterations and comparisons when updating the earliestReadmitTime, leading to better performance in scenarios with many nodes.

Solution

Update the _ReadmitNodes() method in the ManagedNetwork to include the optimization.

Alternatives

No response

@bamzedev bamzedev added the enhancement New feature or request label Mar 17, 2023
@bamzedev bamzedev added this to the 2.23.0 milestone Mar 17, 2023
@bamzedev
Copy link
Contributor Author

Fixed in v2.23.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant