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

Feat/neighbour limit #120

Merged
merged 8 commits into from
Mar 15, 2024
Merged

Feat/neighbour limit #120

merged 8 commits into from
Mar 15, 2024

Conversation

clementnuss
Copy link
Contributor

@clementnuss clementnuss commented Mar 12, 2024

instead of querying all (valid) neighbouring pods, we filter and
only query KUBENURSE_NEIGHBOUR_LIMIT other neighbours.
the algorithm is implemented as follows:

  • hashes are the first 64bits of sha256.Sum(...)
  • we subtract the current node's hash from every other node name hash (so the smallest hashes will be the "closest" hashes to the current node)
  • we put those subtracted hashes in a max-heap
  • every time the heap grows larger than the neighbourhood_limit, we pop the max element

thus at the end, the heap contains the 10 next neighbour nodes for our current node

instead of querying all (valid) neighbouring pods, we filter and
only query KUBENURSE_NEIGHBOUR_LIMIT other neighbours.
To make sure that all nodes get the right number of queries, we
hash each node name, put that in a sorted list (l), and each pod will
query the e.g. 10 next nodes in the list, starting from the position
given by the node name' hash.
i.e. for node named n, we query the 10 next nodes in the list,
starting from position l[hash(n)] + 1

cf #55

Signed-off-by: Clément Nussbaumer <clement.nussbaumer@postfinance.ch>
Signed-off-by: Clément Nussbaumer <clement.nussbaumer@postfinance.ch>
Signed-off-by: Clément Nussbaumer <clement.nussbaumer@postfinance.ch>
Signed-off-by: Clément Nussbaumer <clement.nussbaumer@postfinance.ch>
Signed-off-by: Clément Nussbaumer <clement.nussbaumer@postfinance.ch>
@coveralls
Copy link

coveralls commented Mar 12, 2024

Pull Request Test Coverage Report for Build 8282544160

Details

  • 65 of 82 (79.27%) changed or added relevant lines in 5 files are covered.
  • 2 unchanged lines in 2 files lost coverage.
  • Overall coverage decreased (-5.1%) to 64.048%

Changes Missing Coverage Covered Lines Changed/Added Lines %
internal/servicecheck/neighbours.go 51 54 94.44%
internal/kubenurse/server.go 7 11 63.64%
internal/servicecheck/httptrace.go 3 13 23.08%
Files with Coverage Reduction New Missed Lines %
internal/servicecheck/httptrace.go 1 38.64%
internal/servicecheck/neighbours.go 1 88.17%
Totals Coverage Status
Change from base Build 8154839966: -5.1%
Covered Lines: 424
Relevant Lines: 662

💛 - Coveralls

Signed-off-by: Clément Nussbaumer <clement.nussbaumer@postfinance.ch>
Signed-off-by: Clément Nussbaumer <clement.nussbaumer@postfinance.ch>
@clementnuss clementnuss marked this pull request as ready for review March 12, 2024 15:20
Copy link
Member

@zbindenren zbindenren left a comment

Choose a reason for hiding this comment

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

LGTM.

Maybe add in a later MR a metric when a node is not getting scaped.

Signed-off-by: Clément Nussbaumer <clement.nussbaumer@postfinance.ch>
@clementnuss clementnuss merged commit d1fd0a8 into master Mar 15, 2024
10 checks passed
@clementnuss clementnuss deleted the feat/neighbour_limit branch April 5, 2024 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants