-
Notifications
You must be signed in to change notification settings - Fork 85
Worker pool for current thread runtimes #5134
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
Conversation
Signed-off-by: Nicholas Gates <[email protected]>
Signed-off-by: Nicholas Gates <[email protected]>
Benchmarks: Random AccessSummary
|
Benchmarks: TPC-H SF=1 on NVMESummary
Detailed Results Table
|
Benchmarks: FineWeb NVMeSummary
Detailed Results Table
|
Benchmarks: FineWeb S3Summary
Detailed Results Table
|
Codecov Report❌ Patch coverage is
☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Benchmarks: TPC-H SF=1 on S3Summary
Detailed Results Table
|
Benchmarks: TPC-H SF=10 on NVMESummary
Detailed Results Table
|
Benchmarks: TPC-DS SF=1 on NVMESummary
Detailed Results Table
|
Benchmarks: CompressionSummary
Detailed Results Table
|
Benchmarks: GitHub Archive (S3)Summary
Detailed Results Table
|
Benchmarks: TPC-H SF=10 on S3Summary
Detailed Results Table
|
Benchmarks: GitHub Archive (NVMe)Summary
Detailed Results Table
|
Benchmarks: Clickbench on NVMESummary
Detailed Results Table
|
Benchmarks: Statistical and Population GeneticsSummary
Detailed Results Table
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this supposed to be used in this pr or just passed around?
| // SPDX-FileCopyrightText: Copyright the Vortex contributors | ||
|
|
||
| #![allow(clippy::missing_safety_doc)] | ||
| // **WARNING end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's this for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great question
| // Note that this is optional and without it, we would only drive the task when DuckDB calls | ||
| // into us, and we call `RUNTIME.block_on`. | ||
| #[allow(dead_code)] | ||
| worker_pool: CurrentThreadWorkerPool, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this dead code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to keep it alive as it holds onto the threads, but never need to do anything with it
| .name("vortex-current-thread-worker".to_string()) | ||
| .spawn(move || { | ||
| // Run the executor with a sleeping future that checks for shutdown | ||
| block_on(executor.run(async move { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The thing that wasn't immediately obvious to me is that this is not run this closure but run this executor until this future completes which maybe makes more sense if you have more rust runtime building experience. I.e. I thought this was spawn but there's spawn on this executor as well. This is just a comment for my understanding
| /// with the desired number of worker threads that will drive work on behalf of the runtime. | ||
| #[derive(Clone, Default)] | ||
| pub struct CurrentThreadRuntime { | ||
| executor: Arc<smol::Executor<'static>>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this a deliberate choice why this is not imported at the top level?
| /// | ||
| /// By default, the pool has no worker threads; the caller must set the desired number of | ||
| /// worker threads using the `set_workers` method on the returned pool. | ||
| pub fn new_pool(&self) -> CurrentThreadWorkerPool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is the semantic of calling this method twice and having two CurrentThreadWorkerPools pointed at the same CurrentThreadRuntime?
Why isn't managment of workers part of the CurrentThreadRuntime?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both pools can make progress on the same execute. Agree it's a bit odd. Maybe it's worth just having a pool inside the runtime?
This allows current thread runtimes to have a dynamic number of background threads partaking in the work.
Removes the Tokio dependency from vortex-duckdb
Other language bindings should migrate to this runtime and expose a set_worker_threads(n) function to the language.