Context
In sidecar mode, each volume mount calls build() which creates its own tokio::runtime::Runtime (multi-threaded). With N volumes, we get N full runtimes (~4 threads each).
Current behavior
main() spawns N threads
thread 1: build(vol1) -> new Runtime -> mount_fuse
thread 2: build(vol2) -> new Runtime -> mount_fuse
Proposed
Split build() to accept an existing runtime handle:
// main creates one runtime
let runtime = tokio::runtime::Builder::new_multi_thread().build()?;
// Each volume reuses it
let setup1 = build_with_runtime(source1, opts1, runtime.handle());
let setup2 = build_with_runtime(source2, opts2, runtime.handle());
This requires MountSetup to hold a Handle instead of owning the Runtime, and the caller to keep the Runtime alive.
Impact
Low priority. With 1-2 volumes per pod (typical), the overhead is ~4 extra threads. Worth doing as part of a broader build() / MountSetup refactor.
Related: #86 (sidecar PR)
Context
In sidecar mode, each volume mount calls
build()which creates its owntokio::runtime::Runtime(multi-threaded). With N volumes, we get N full runtimes (~4 threads each).Current behavior
Proposed
Split
build()to accept an existing runtime handle:This requires
MountSetupto hold aHandleinstead of owning theRuntime, and the caller to keep theRuntimealive.Impact
Low priority. With 1-2 volumes per pod (typical), the overhead is ~4 extra threads. Worth doing as part of a broader
build()/MountSetuprefactor.Related: #86 (sidecar PR)