feat: run queries on their own Tokio runtime - #476
Merged
Merged
Conversation
One runtime served the API and ran every query. A scan holds a worker until a partition yields, so one long query took every thread and the API stopped answering. Queries now run on a second runtime. BEACON_API_THREADS sizes the API runtime. The result stream crosses between the two over a bounded channel.
7 tasks
This file contains hidden or 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
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.
What changes does this PR make?
Queries run on their own Tokio runtime. The API runs on a second one.
Why do you make these changes?
One runtime served the API and ran every query. A scan holds a worker until a partition yields. One long query took every thread. The API stopped answering.
How do you make these changes?
mainbuilds two runtimes. The newquery_executormodule in beacon-core holds the query handle. Planning and execution run there. A bounded channel moves batches to the caller. A disconnect cancels the query. A panic reaches the client as an error.Does this PR change a public interface or a configuration?
New variable
BEACON_API_THREADS, default 4.Server::opentakes the query runtime handle. Not breaking.How do you test these changes?
Seven unit tests cover the executor. One config test covers thread counts.
Four known Windows-only tests fail, as on
main.Checklist
rustfmt.Was this patch authored or co-authored using generative AI tooling?
Yes. Assisted-by: Claude:claude-fable-5-1