Skip to main content

run

Function run 

Source
pub fn run(
    snap_path: PathBuf,
    _block_size: Option<u32>,
    _duration: Option<u64>,
    _threads: Option<usize>,
) -> Result<()>
Expand description

Execute the benchmark command on a Hexz snapshot.

This function runs a sequential read benchmark to measure snapshot read performance. It opens the snapshot, configures the appropriate decompressor, and reads the entire disk stream in 1 MiB chunks while measuring throughput.

§Benchmark Methodology

The test performs a single sequential pass over the entire disk stream:

  1. Opens the snapshot and loads the header
  2. Configures the decompressor (LZ4 or Zstd) with any embedded dictionary
  3. Reads the disk stream sequentially in 1 MiB chunks
  4. Measures total time and calculates throughput

§Arguments

  • snap_path - Path to the .hxz snapshot file
  • _block_size - Reserved for future random I/O tests (currently unused)
  • _duration - Reserved for time-limited tests (currently unused)
  • _threads - Reserved for multi-threaded tests (currently unused)

§Performance Notes

This benchmark tests the full read path including:

  • Storage backend I/O (file reads, network fetches)
  • Decompression (LZ4 or Zstd)
  • Block cache effectiveness (if cache is enabled)

For accurate results:

  • Run on a representative hardware configuration
  • Ensure the snapshot is not cached in system page cache (or run multiple iterations)
  • Compare results across compression algorithms and block sizes

§Example Output

Benchmarking snapshot: "vm-snapshot.hxz"
Image Size: 10.0 GB

Running Sequential Read Test (1 pass)...
[████████████████████] 10.0 GB/10.0 GB (250 MB/s)

Total Read: 10.0 GB
Duration: 40.23s
Throughput: 248.57 MB/s