-
Notifications
You must be signed in to change notification settings - Fork 352
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
improve placing algorithm #5051
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fulmicoton
reviewed
Jun 4, 2024
fulmicoton
reviewed
Jun 4, 2024
let mut candidate_nodes_iter = candidate_nodes.iter().enumerate(); | ||
// Select a node which hasn't reached the target load | ||
let chosen_node_idx = loop { | ||
let Some((id, candidate_node)) = candidate_nodes_iter.next() else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think .iter_mut().find(||)
would be clearer than this loop with break?
let chosen_node: &mut CandidateNodes =
if let Some(candidate) = candidate_nodes.iter_mut()
.find(|candidate| candidate.load < target_load) {
candidate
} else {
&mut candidate_nodes[0]
};
fulmicoton
requested changes
Jun 4, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see comments
fulmicoton
reviewed
Jun 4, 2024
fulmicoton
reviewed
Jun 4, 2024
fulmicoton
approved these changes
Jun 11, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
fix #5010
improve the job placing algorithm, to increase the chance of hitting the searcher with the highest affinity.
Also add a primitive cost evaluation of splits, based only on the count of documentation.
How was this PR tested?
updated tests
added tests with many splits
tested manually with #4998 applied to verify the number of jobs run with affinity=0 improved (it did)
i had to modify some things to keep some root_search tests working, as now it is possible that searching 2 splits with 2 searchers ends up querying only one searcher.
(with N the job cost, assuming all jobs equals,
target_load = ⌈2 * N * (1+ ε) / 2⌉ = N+1
, after the 1st split, load is only N so the 2nd split can use the same searcher).I've documented multiple fixes, and implemented the one that seemed most sensible to me