Skip to content

Enable customization of Tokio runtimes in diskann-benchmark-core#809

Merged
hildebrandmw merged 1 commit intomainfrom
users/mhildebr/tokio-builders
Mar 4, 2026
Merged

Enable customization of Tokio runtimes in diskann-benchmark-core#809
hildebrandmw merged 1 commit intomainfrom
users/mhildebr/tokio-builders

Conversation

@hildebrandmw
Copy link
Contributor

Enable caller customization of the runtimes built with two new methods:

  • diskann_benchmark_core::tokio::runtime_with: Construct a new runtime allowing the caller to customize the builder before creation.
  • diskann_benchmark_core::search::search_all_with: Allow the caller to customize each runtime that gets created during the bulk search operation.

Downstream work has revealed the need to enable timing in the tokio runtimes. Instead of forcing all consumers of diskann-benchmark-core to opt-in to timing, this PR allows callers to opt-in selectively.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds public extension points so consumers of diskann-benchmark-core can customize Tokio runtime creation (e.g., opt-in Builder::enable_time) without changing the default runtime configuration used by the crate.

Changes:

  • Add diskann_benchmark_core::tokio::runtime_with to allow caller customization of a preconfigured multi-thread runtime Builder.
  • Add diskann_benchmark_core::search::search_all_with to apply a caller-provided builder callback to each runtime created during search_all.
  • Extend/adjust tests and docs to cover the new APIs.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
diskann-benchmark-core/src/tokio.rs Introduces runtime_with and adds tests validating customization and worker count.
diskann-benchmark-core/src/search/api.rs Adds search_all_with, routes search_all through it, and extends tests/docs accordingly.
Comments suppressed due to low confidence (1)

diskann-benchmark-core/src/tokio.rs:28

  • runtime_with duplicates the base builder setup currently done in runtime(). To avoid the two functions drifting if the default runtime configuration changes in the future, consider implementing runtime() in terms of runtime_with(num_threads, |_| {}) (or factoring out a shared helper that returns the preconfigured Builder).
pub fn runtime_with<F>(num_threads: usize, f: F) -> anyhow::Result<tokio::runtime::Runtime>
where
    F: FnOnce(&mut tokio::runtime::Builder),
{
    let mut builder = tokio::runtime::Builder::new_multi_thread();
    builder.worker_threads(num_threads);
    f(&mut builder);
    Ok(builder.build()?)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 98.66667% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 89.46%. Comparing base (f206264) to head (79031b9).

Files with missing lines Patch % Lines
diskann-benchmark-core/src/tokio.rs 96.55% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #809   +/-   ##
=======================================
  Coverage   89.45%   89.46%           
=======================================
  Files         432      432           
  Lines       79452    79514   +62     
=======================================
+ Hits        71075    71136   +61     
- Misses       8377     8378    +1     
Flag Coverage Δ
miri 89.46% <98.66%> (+<0.01%) ⬆️
unittests 89.31% <98.66%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
diskann-benchmark-core/src/search/api.rs 97.84% <100.00%> (+0.20%) ⬆️
diskann-benchmark-core/src/tokio.rs 97.50% <96.55%> (-2.50%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@hildebrandmw hildebrandmw merged commit aa5fb99 into main Mar 4, 2026
28 checks passed
@hildebrandmw hildebrandmw deleted the users/mhildebr/tokio-builders branch March 4, 2026 16:57
@hildebrandmw hildebrandmw mentioned this pull request Mar 4, 2026
hildebrandmw added a commit that referenced this pull request Mar 4, 2026
## What's Changed
* Expand BetaFilter for External SearchStrategy Implementations by
@hailangx in #793
* Enable Miri tests in CI with non-blocking execution by @Copilot in
#697
* Increase unit test coverage for diskann-disk crate by @Copilot in
#761
* Add code review instructions for license headers by @harsha-simhadri
in #801
* Consolidate `load_bin` somewhat by @hildebrandmw in
#792
* Add RFC process by @suri-kumkaran in
#804
* Fix variance issues with `Mat` and `MatMut`. by @hildebrandmw in
#806
* [Bugfix] NeighborPriorityQueue panics, when it is at capacity and NaN
distance is inserted by @arrayka in
#796
* Enable `cache_only` mode for the BF-Tree cache by @hildebrandmw in
#810
* Enable customization of Tokio runtimes in `diskann-benchmark-core` by
@hildebrandmw in #809

## New Contributors
* @hailangx made their first contribution in
#793

**Full Changelog**:
v0.47.0...v0.48.0

Co-authored-by: Mark Hildebrand <mhildebrand@microsoft.com>
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.

5 participants