# Benchmarking This repository includes a small local benchmark harness built around the shipped sample scenarios. ## Benchmark Script - [hacks/benchmark_samples.sh](../hacks/benchmark_samples.sh) The script: - builds `xburner` unless `SKIP_ZIG_BUILD=1` - rebuilds the workflow sample guest unless `SKIP_WORKFLOW_WASM_BUILD=1` - starts the local sample HTTP servers unless `SKIP_SERVER=1` - runs: - simple sample - simple config-loader fixture - workflow sample on `wamr` - workflow sample on `wasm3` - workflow config-loader fixture on `wamr` - workflow config-loader fixture on `wasm3` - prints a compact tab-separated table with: - scenario - backend - requests - iterations - error rate - p50 latency - p99 latency ## Usage ```sh sh hacks/benchmark_samples.sh ``` Optional filters: - `sh hacks/benchmark_samples.sh simple` - `sh hacks/benchmark_samples.sh workflow` - `sh hacks/benchmark_samples.sh config-loader` - `sh hacks/benchmark_samples.sh all --tsv-out /tmp/xburner-bench.tsv` ## Notes - This is a local harness, not a stable benchmarking API. - It is intended for relative comparisons while working on the codebase. - For reproducible results, run it on an otherwise idle machine and keep the sample server local. - It intentionally benchmarks successful scenarios only. Threshold-failure fixtures such as the `abort_on_fail` config-loader case are not included in this table. ## Latency Histogram `xburner` currently keeps request latency percentiles in a fixed log-scale histogram: - `2048` buckets - bucket growth factor `1.02` - reported percentiles use the upper bound of the selected bucket Why this shape is kept for now: - memory usage stays fixed during long runs - no per-sample allocations are needed while recording request latency - percentile error is bounded and easy to reason about: the reported value can overestimate the exact percentile by roughly `2%` `HdrHistogram`-style layouts were considered, but the current fixed histogram is sufficient for the project’s current summary contract and is simpler to keep deterministic across long-running tests.