Introduce async search API and log activation #120024
Open
+186
−106
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.
This code here is good to review but lets discuss the motivation first tomorrow maybe :)
This adds an async search API to ContextIndexSearcher that could be used to avoid any blocking on futures in the query phase in a relatively straight-forward and short follow-up.
For now this solves a lot of queuing issues by leveraging the custom execution path this gives us to run tasks using logarithmic activation. We now always slice to up-to thread_count tasks but at max submit thread_count - 1 (the submitting tasks is the remaining search thread) tasks to the search pool. Unlike before, these tasks are only submitted as the pool actually has workers available. This means we decrease latency when tasks are fast by running fewer tasks than before potentially but also eventually get to full parallelism (no matter the queue length, so long as it's not full yet) for things like heavy aggregations. Depending on the relative performance of context switches and task execution this approach self-regulates in a similar manner to how the JDK's fork-join pool works.