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

Introduce async search API and log activation #120024

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

original-brownbear
Copy link
Member

@original-brownbear original-brownbear commented Jan 13, 2025

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.

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.
@original-brownbear original-brownbear added >non-issue :Search Foundations/Search Catch all for Search Foundations labels Jan 13, 2025
@elasticsearchmachine elasticsearchmachine added v9.0.0 Team:Search Foundations Meta label for the Search Foundations team in Elasticsearch labels Jan 13, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-search-foundations (Team:Search Foundations)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>non-issue :Search Foundations/Search Catch all for Search Foundations Team:Search Foundations Meta label for the Search Foundations team in Elasticsearch v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants