feat(disk): isolate fsync blocking pool from main runtime

Add a dedicated tokio blocking runtime for fsync/fdatasync operations,
controlled by RUSTFS_RUNTIME_FSYNC_BLOCKING_THREADS (default 0 = off).

When configured with >1 threads, fsync operations are dispatched to a
separate blocking pool so device-bound fsync does not starve read
operations (pread/stat/open) on the main blocking pool.

Changed call sites:
- run_file_sync_blocking (batch fdatasync)
- fsync_dir (directory fsync)
- fsync_open_dst_dir_group (dst dir group fsync)
- run_blocking_namespace_file_sync_operation_with_global (namespace+fsync)

Unchanged (stay on main pool):
- run_blocking_namespace_operation (rename/metadata)
- local.rs spawn_blocking calls (pread/stat/open)

Default behavior is unchanged (0 = no isolation).

Co-Authored-By: heihutu <heihutu@gmail.com>
This commit is contained in:
houseme
2026-08-21 22:26:27 +08:00
parent adb90fc6e1
commit e4c7e12098
2 changed files with 49 additions and 4 deletions
+7
View File
@@ -57,6 +57,13 @@ pub const DEFAULT_MAX_IO_EVENTS_PER_TICK: usize = 1024;
pub const DEFAULT_EVENT_INTERVAL: u32 = 61;
pub const DEFAULT_RNG_SEED: Option<u64> = None; // None means random
/// Dedicated blocking thread pool for fsync/fdatasync operations.
/// When > 1, fsync operations are isolated from the main blocking pool to
/// prevent device-bound fsync from starving read operations (pread/stat/open).
/// Default 0 means auto (no isolation, use main runtime).
pub const ENV_FSYNC_BLOCKING_THREADS: &str = "RUSTFS_RUNTIME_FSYNC_BLOCKING_THREADS";
pub const DEFAULT_FSYNC_BLOCKING_THREADS: usize = 0;
// Dial9 Tokio Telemetry Default values
pub const DEFAULT_RUNTIME_DIAL9_ENABLED: bool = false; // Disabled by default
pub const DEFAULT_RUNTIME_DIAL9_OUTPUT_DIR: &str = "/var/log/rustfs/telemetry";