Skip to content

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

Closed
robinskil wants to merge 1 commit into
mainfrom
feature/worker-pool-seperation
Closed

robinskil wants to merge 1 commit into
mainfrom
feature/worker-pool-seperation

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 closed this Sep 4, 2026
@robinskil
robinskil deleted the feature/worker-pool-seperation branch September 4, 2026 12:14
@robinskil

Copy link
Copy Markdown
Collaborator Author

Closed by the branch rename. The same change continues in #476.

@codecov

codecov Bot commented Sep 4, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 87.54864% with 32 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.23%. Comparing base (1d726a7) to head (fa3ee2e).

Files with missing lines Patch % Lines
beacon-server/beacon-server/src/main.rs 0.00% 25 Missing ⚠️
beacon-db/beacon-core/src/query_executor.rs 95.67% 7 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #475      +/-   ##
==========================================
+ Coverage   83.20%   83.23%   +0.02%     
==========================================
  Files         372      373       +1     
  Lines       62250    62526     +276     
==========================================
+ Hits        51798    52044     +246     
- Misses      10452    10482      +30     
Files with missing lines Coverage Δ
beacon-db/beacon-core/src/runtime.rs 97.21% <100.00%> (-0.17%) ⬇️
beacon-db/beacon-core/src/runtime_builder.rs 92.23% <100.00%> (+0.01%) ⬆️
beacon-server/beacon-server-config/src/lib.rs 94.78% <100.00%> (+0.32%) ⬆️
beacon-server/beacon-server/src/server/mod.rs 84.48% <100.00%> (+0.08%) ⬆️
beacon-db/beacon-core/src/query_executor.rs 95.67% <95.67%> (ø)
beacon-server/beacon-server/src/main.rs 19.62% <0.00%> (-4.52%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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