50 lines
2.3 KiB
Markdown
50 lines
2.3 KiB
Markdown
# System-Disk Small-File I/O Benchmark Suite
|
|
|
|
Three-layer measurement toolkit for macOS guest system disk (`disk.qcow2`) I/O analysis:
|
|
|
|
1. **Guest layer (`cmd/guest-bench`)**: Cross-compiled `darwin/amd64` Go benchmark covering:
|
|
- `create-fsync`: 1000 x 4 KiB file creation with `fsync`
|
|
- `create-fullfsync`: 1000 x 4 KiB file creation with macOS `fcntl(F_FULLFSYNC)`
|
|
- `read-seq` / `read-rand`: 1000 x 4 KiB sequential and random file reads
|
|
- `stat-tree`: 1000-file, 3-level directory tree traversal + `lstat`
|
|
- `rand-read-large`: 4 KiB random reads spanning large files across the virtual disk (for L2 cache coverage testing)
|
|
2. **QEMU block layer (`cmd/qmp-blockstats`)**: Short-lived QMP client over `<vmDir>/qmp.sock` querying `query-blockstats` and configuring `block-latency-histogram-set`, computing read/write/flush deltas, flush time share, latency histogram percentiles, and `qcow2` -> `file-win32` parent amplification.
|
|
3. **Host disk layer (`collect-host-disk.ps1`)**: Locale-independent Windows `Win32_PerfRawData_PerfDisk_PhysicalDisk` snapshot 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:
|
|
|
|
```powershell
|
|
.\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 passwordless `sudo purge` inside 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:
|
|
|
|
```powershell
|
|
.\scripts\io-bench\run-bench.ps1 `
|
|
-VmDir "<vmDir>" -SshUser "<user>" -OutDir ".\out\workflow" `
|
|
-Workloads @() -WorkflowName "git-status" -WorkflowCmd "cd ~/project && git status"
|
|
```
|
|
|
|
## Verification
|
|
|
|
```powershell
|
|
go test ./internal/qmp/... ./scripts/io-bench/...
|
|
```
|