1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
//! # Tuning Direct IO — buffer pool + io_uring queue depth
//!
//! `Method::Direct` exposes three knobs that a workload-specific
//! tuning pass can move:
//!
//! - `buffer_pool_count(n)` — number of aligned buffers in the
//! per-handle pool (default 64). Idle handles cost zero buffer
//! memory; the pool is allocated lazily on the first Direct op.
//! Larger pool = less allocation pressure on bursty workloads,
//! higher per-handle resident memory.
//! - `buffer_pool_block_size(bytes)` — per-buffer size in bytes
//! (default 4096). Direct workloads with payloads larger than the
//! default benefit from 64 KiB or 1 MiB blocks (fewer leases per
//! op).
//! - `io_uring_queue_depth(depth)` — Linux io_uring SQ depth
//! (default 128). Higher depth helps when the workload has many
//! in-flight ops; lower depth reduces kernel memory.
//!
//! These are tuning knobs, not contracts — defaults are chosen for
//! "good enough on most workloads." Move them only after
//! benchmarking against the workload you actually have. See
//! `docs/PERFORMANCE.md` for tuning guidance.
//!
//! Run: `cargo run --example 16_tuning_direct`
use ;