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

improve placing algorithm #5051

Merged
merged 7 commits into from
Jun 11, 2024
Merged

improve placing algorithm #5051

merged 7 commits into from
Jun 11, 2024

Conversation

trinity-1686a
Copy link
Contributor

@trinity-1686a trinity-1686a commented May 30, 2024

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

@trinity-1686a trinity-1686a requested a review from fulmicoton May 30, 2024 13:52
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 {
Copy link
Contributor

@fulmicoton fulmicoton Jun 4, 2024

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]
                };

Copy link
Contributor

@fulmicoton fulmicoton left a comment

Choose a reason for hiding this comment

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

see comments

Copy link

github-actions bot commented Jun 7, 2024

On SSD:

Average search latency is 1.0x that of the reference (lower is better).
Ref run id: 1988, ref commit: 2bf586e
Link

On GCS:

Average search latency is 0.923x that of the reference (lower is better).
Ref run id: 1989, ref commit: 2bf586e
Link

@trinity-1686a trinity-1686a requested a review from fulmicoton June 7, 2024 14:22
@trinity-1686a trinity-1686a merged commit 48c55cf into main Jun 11, 2024
5 checks passed
@trinity-1686a trinity-1686a deleted the trinity/placing-algorithm branch June 11, 2024 09:33
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.

Change the algorithm that place split search on searcher
2 participants