Skip to content

feat: run queries on their own Tokio runtime - #476

Merged
robinskil merged 1 commit into
mainfrom
feature/worker-pool-separation
Sep 4, 2026
Merged

robinskil merged 1 commit into
mainfrom
feature/worker-pool-separation

Conversation

@robinskil

Copy link
Copy Markdown
Collaborator

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?

main builds two runtimes. The new query_executor module 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::open takes the query runtime handle. Not breaking.

How do you test these changes?

Seven unit tests cover the executor. One config test covers thread counts.

cargo test -p beacon-core -p beacon-server -p beacon-server-config --tests

Four known Windows-only tests fail, as on main.

Checklist

  • Title describes the change.
  • Changed lines pass rustfmt.
  • No new clippy warnings.
  • Tests pass.
  • New code has tests.
  • Docs and CHANGELOG show the change.
  • No unrelated changes.

Was this patch authored or co-authored using generative AI tooling?

Yes. Assisted-by: Claude:claude-fable-5-1

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.
@robinskil robinskil self-assigned this Sep 4, 2026
@robinskil
robinskil merged commit 294e328 into main Sep 4, 2026
12 checks passed
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.

1 participant