System-Disk Small-File I/O Benchmark Suite
Three-layer measurement toolkit for macOS guest system disk (disk.qcow2) I/O analysis:
- Guest layer (
cmd/guest-bench): Cross-compileddarwin/amd64Go benchmark covering:create-fsync: 1000 x 4 KiB file creation withfsynccreate-fullfsync: 1000 x 4 KiB file creation with macOSfcntl(F_FULLFSYNC)read-seq/read-rand: 1000 x 4 KiB sequential and random file readsstat-tree: 1000-file, 3-level directory tree traversal +lstatrand-read-large: 4 KiB random reads spanning large files across the virtual disk (for L2 cache coverage testing)
- QEMU block layer (
cmd/qmp-blockstats): Short-lived QMP client over<vmDir>/qmp.sockqueryingquery-blockstatsand configuringblock-latency-histogram-set, computing read/write/flush deltas, flush time share, latency histogram percentiles, andqcow2->file-win32parent amplification. - Host disk layer (
collect-host-disk.ps1): Locale-independent WindowsWin32_PerfRawData_PerfDisk_PhysicalDisksnapshot and diff for average read/write/transfer latency, queue depth, IOPS, and throughput.
Usage
Run the full three-layer suite against a running macOS VM with SSH port forwarding enabled:
.\scripts\io-bench\run-bench.ps1 `
-VmDir "<DataRoot>\data\reims-ctl\vms\<vm-name>" `
-RuntimeDir "<DataRoot>\runtimes\<runtime-id>" `
-SshUser "<guest-user>" `
-SshPort 2222 `
-CacheMode warm `
-Iterations 5 `
-Label baseline `
-OutDir ".\out\io-bench-baseline"
Cold-Cache Notes
- Guest cache: Pass
-CacheMode guest-cold -GuestSudoPurge(requires passwordlesssudo purgeinside the guest). - Host cache: Automated scripts never elevate. For host-cold measurements, reboot the host or manually clear the Windows Standby List before running with
-CacheMode both-cold.
Real-Workflow Timing
Pass -Workloads @() together with -WorkflowName and -WorkflowCmd to measure a real project workflow (e.g., npm install, git status, git checkout, incremental build) across all three layers:
.\scripts\io-bench\run-bench.ps1 `
-VmDir "<vmDir>" -SshUser "<user>" -OutDir ".\out\workflow" `
-Workloads @() -WorkflowName "git-status" -WorkflowCmd "cd ~/project && git status"
Verification
go test ./internal/qmp/... ./scripts/io-bench/...