|
| 1 | +# Sysbench_Performance |
| 2 | + |
| 3 | +This suite runs a **repeatable Sysbench performance baseline** on Yocto/QLI targets in a CI-friendly way. |
| 4 | + |
| 5 | +It runs the following test cases for one or more thread counts and for N iterations: |
| 6 | + |
| 7 | +- **CPU** (`sysbench cpu`) |
| 8 | +- **Memory bandwidth** (`sysbench memory`) |
| 9 | +- **Threads** (`sysbench threads`) |
| 10 | +- **Mutex** (`sysbench mutex`) |
| 11 | +- **File I/O throughput** (`sysbench fileio`) — **seqwr / seqrd / rndwr / rndrd** |
| 12 | + |
| 13 | +For each case it: |
| 14 | +- prints sysbench output live to console (and saves per-iteration logs), |
| 15 | +- records per-iteration KPIs into `*.values` files, |
| 16 | +- prints a compact per-iteration KPI line (`ITER_SUMMARY`) to console, |
| 17 | +- computes averages and writes `OUT_DIR/sysbench_summary.txt`, |
| 18 | +- optionally appends per-iteration + avg rows to a CSV (only if `CSV_FILE` is provided), |
| 19 | +- optionally enforces PASS/FAIL **baseline gating** (when a baseline file is provided or auto-detected). |
| 20 | + |
| 21 | +--- |
| 22 | + |
| 23 | +## KPIs collected (and “better” direction) |
| 24 | + |
| 25 | +| Case | KPI name (run.sh / baseline key) | Unit | Better | |
| 26 | +|---|---|---:|---| |
| 27 | +| CPU | `cpu_time_sec` | seconds | **lower** | |
| 28 | +| Memory | `memory_mem_mbps` | MB/s | **higher** | |
| 29 | +| Threads | `threads_time_sec` | seconds | **lower** | |
| 30 | +| Mutex | `mutex_time_sec` | seconds | **lower** | |
| 31 | +| File I/O seq write | `fileio_seqwr_mbps` | MB/s | **higher** | |
| 32 | +| File I/O seq read | `fileio_seqrd_mbps` | MB/s | **higher** | |
| 33 | +| File I/O rnd write | `fileio_rndwr_mbps` | MB/s | **higher** | |
| 34 | +| File I/O rnd read | `fileio_rndrd_mbps` | MB/s | **higher** | |
| 35 | + |
| 36 | +> Note: even if you think of reads as “GB/s”, the suite **stores and gates in MB/s** for consistency. |
| 37 | +> If you have a baseline in GB/s, convert to MB/s (GB/s × 1024). |
| 38 | +
|
| 39 | +--- |
| 40 | + |
| 41 | +## Baseline gating (PASS/FAIL) |
| 42 | + |
| 43 | +Baseline gating is enabled when either: |
| 44 | +- `BASELINE_FILE` / `--baseline FILE` is set, **or** |
| 45 | +- `./sysbench_baseline.conf` exists in the **same folder as `run.sh`** (auto-detected). |
| 46 | + |
| 47 | +`ALLOWED_DEVIATION` / `--delta` controls tolerance: |
| 48 | + |
| 49 | +- **Higher-is-better** metrics (MB/s): |
| 50 | + **PASS** if `avg >= baseline * (1 - delta)` |
| 51 | + (recommend **0.05** → “>= 95% of baseline”) |
| 52 | +- **Lower-is-better** metrics (seconds): |
| 53 | + **PASS** if `avg <= baseline * (1 + delta)` |
| 54 | + (recommend **0.05** → “<= 105% of baseline”) |
| 55 | + |
| 56 | +The console shows a per-metric GATE line and `sysbench_summary.txt` includes a `gate_*` section. |
| 57 | + |
| 58 | +--- |
| 59 | + |
| 60 | +## Baseline file format (`sysbench_baseline.conf`) |
| 61 | + |
| 62 | +Plain `key=value` format (comments allowed with `#`). Keys are per-thread-count: |
| 63 | + |
| 64 | +``` |
| 65 | +# ---- Threads = 4 ---- |
| 66 | +cpu_time_sec.t4=3.483 |
| 67 | +memory_mem_mbps.t4=4120.000 |
| 68 | +threads_time_sec.t4=3.703 |
| 69 | +mutex_time_sec.t4=0.004 |
| 70 | +
|
| 71 | +fileio_seqwr_mbps.t4=0.400 |
| 72 | +fileio_seqrd_mbps.t4=29.300 |
| 73 | +fileio_rndwr_mbps.t4=0.610 |
| 74 | +fileio_rndrd_mbps.t4=29.300 |
| 75 | +``` |
| 76 | + |
| 77 | +Use `t1`, `t4`, `t8`, … matching your `THREADS_LIST`. |
| 78 | + |
| 79 | +--- |
| 80 | + |
| 81 | +## Parameters (env vars / CLI) |
| 82 | + |
| 83 | +The suite is controlled by environment variables (and equivalent CLI flags). Typical params: |
| 84 | + |
| 85 | +### Common |
| 86 | +- `OUT_DIR` (default `./sysbench_out`) – where logs / values / summary go |
| 87 | +- `ITERATIONS` (default `1`) |
| 88 | +- `TIME` (default `30`) |
| 89 | +- `RAND_SEED` (default `1234`) |
| 90 | +- `THREADS_LIST` (default `"4"`) – space-separated list of thread counts |
| 91 | +- `TASKSET_CPU_LIST` (default empty) – passed to `taskset -c`, e.g. `"6-7"` |
| 92 | +- `BASELINE_FILE` (default empty; auto-detects `sysbench_baseline.conf` next to `run.sh`) |
| 93 | +- `ALLOWED_DEVIATION` (default `0.10`; recommended `0.05`) |
| 94 | +- `CSV_FILE` (default empty → **no CSV by default**) |
| 95 | + |
| 96 | +### CPU |
| 97 | +- `CPU_MAX_PRIME` (default `20000`) |
| 98 | + |
| 99 | +### Threads |
| 100 | +- `THREAD_LOCKS` (default `20`) |
| 101 | +- `THREAD_YIELDS` (default empty → sysbench default) |
| 102 | + |
| 103 | +### Memory |
| 104 | +- `MEMORY_OPER` (default `write`) – `read|write` |
| 105 | +- `MEMORY_ACCESS_MODE` (default `rnd`) – `seq|rnd` |
| 106 | +- `MEMORY_BLOCK_SIZE` (default `1M`) |
| 107 | +- `MEMORY_TOTAL_SIZE` (default `100G`) |
| 108 | + |
| 109 | +### File I/O |
| 110 | +File I/O uses sysbench `fileio` with a **prepare → run → cleanup** flow. |
| 111 | + |
| 112 | +Recommended knobs (names match the suite params): |
| 113 | +- `FILEIO_DIR` – directory where files are created (recommended: **tmpfs** like `/tmp`) |
| 114 | +- `FILE_TOTAL_SIZE` – total size per file, e.g. `1G` |
| 115 | +- `FILE_BLOCK_SIZE` – e.g. `4K`, `1M` |
| 116 | +- `FILE_NUM` – number of files, e.g. `1`, `4` |
| 117 | +- `FILE_IO_MODE` – e.g. `sync` (stable), `async` |
| 118 | +- `FILE_FSYNC_FREQ` – optional, e.g. `0` (disable) or `1` (every op) |
| 119 | + |
| 120 | +> Your `run.sh` may expose additional `FILE_*` knobs; keep them documented here as you add them. |
| 121 | +
|
| 122 | +--- |
| 123 | + |
| 124 | +## Safety warning for File I/O |
| 125 | + |
| 126 | +`sysbench fileio` **creates files and performs reads/writes** in `FILEIO_DIR`. |
| 127 | + |
| 128 | +To avoid accidental wear / regression noise: |
| 129 | +- Prefer `FILEIO_DIR=/tmp/...` (tmpfs) for CI gating. |
| 130 | +- If you must test real storage, point to a **dedicated mount** (not `/`), and keep sizes small. |
| 131 | +- Do **NOT** point fileio at your root filesystem (`/`) unless you fully understand the impact. |
| 132 | + |
| 133 | +--- |
| 134 | + |
| 135 | +## Outputs |
| 136 | + |
| 137 | +In `OUT_DIR/` you will see: |
| 138 | + |
| 139 | +- `*_iterN.log` — full sysbench stdout/stderr per test case + iteration |
| 140 | +- `*.values` — one KPI value per iteration (for averaging) |
| 141 | +- `sysbench_summary.txt` — averages + gating summary |
| 142 | +- Optional CSV (only when `CSV_FILE` is set) |
| 143 | + |
| 144 | +Result file: |
| 145 | +- `./Sysbench_Performance.res` — `PASS` / `FAIL` / `SKIP` |
| 146 | + |
| 147 | +--- |
| 148 | + |
| 149 | +## Examples (using our `run.sh`) |
| 150 | + |
| 151 | +All examples are run from: |
| 152 | + |
| 153 | +``` |
| 154 | +cd Runner/suites/Performance/Sysbench_Performance/ |
| 155 | +``` |
| 156 | + |
| 157 | +### 1) Full suite (CPU + memory + threads + mutex + fileio) |
| 158 | +``` |
| 159 | +./run.sh |
| 160 | +``` |
| 161 | + |
| 162 | +### 2) 3 iterations, pin to big cores, tighter gating (95% baseline) |
| 163 | +(Uses `./sysbench_baseline.conf` automatically if present.) |
| 164 | +``` |
| 165 | +./run.sh --iterations 3 --threads-list "4" --taskset-cpu-list "6-7" --delta 0.05 |
| 166 | +``` |
| 167 | + |
| 168 | +### 3) Explicit baseline file path |
| 169 | +``` |
| 170 | +./run.sh --baseline ./sysbench_baseline.conf --delta 0.05 |
| 171 | +``` |
| 172 | + |
| 173 | +### 4) Enable CSV (NOT default) |
| 174 | +``` |
| 175 | +./run.sh --csv ./sysbench_out/sysbench.csv |
| 176 | +``` |
| 177 | + |
| 178 | +### 5) CPU time focus (reduce noise) |
| 179 | +You can’t “run only CPU” without editing the script, but you can reduce runtime: |
| 180 | +``` |
| 181 | +./run.sh --iterations 1 --time 15 --cpu-max-prime 20000 --threads-list "4" |
| 182 | +``` |
| 183 | +Then read: |
| 184 | +- console `ITER_SUMMARY ... cpu_time_sec=...` |
| 185 | +- `OUT_DIR/cpu_t4.values` |
| 186 | +- CSV rows (if enabled) |
| 187 | + |
| 188 | +### 6) Memory bandwidth focus (use seq vs rnd) |
| 189 | +``` |
| 190 | +MEMORY_ACCESS_MODE=seq ./run.sh --iterations 1 --threads-list "4" |
| 191 | +MEMORY_ACCESS_MODE=rnd ./run.sh --iterations 1 --threads-list "4" |
| 192 | +``` |
| 193 | + |
| 194 | +### 7) File I/O on tmpfs (recommended for CI) |
| 195 | +``` |
| 196 | +FILEIO_DIR=/tmp/sysbench_fileio ./run.sh --iterations 1 --threads-list "4" |
| 197 | +``` |
| 198 | + |
| 199 | +### 8) File I/O heavier workload (be careful) |
| 200 | +``` |
| 201 | +FILEIO_DIR=/tmp/sysbench_fileio FILE_TOTAL_SIZE=1G FILE_BLOCK_SIZE=4K FILE_NUM=4 ./run.sh --iterations 1 --threads-list "4" |
| 202 | +``` |
| 203 | + |
| 204 | +### 9) Verifying seq/rnd IO KPIs |
| 205 | +After the run, check: |
| 206 | +- `sysbench_summary.txt` for: |
| 207 | + - `fileio_seqwr_mbps`, `fileio_seqrd_mbps`, `fileio_rndwr_mbps`, `fileio_rndrd_mbps` |
| 208 | +- per-iteration logs: |
| 209 | + - `fileio_*_iter*.log` |
| 210 | + |
| 211 | +--- |
| 212 | + |
| 213 | +## LAVA YAML integration |
| 214 | + |
| 215 | +Your LAVA test definition should: |
| 216 | +- `cd Runner/suites/Performance/Sysbench_Performance/` |
| 217 | +- run `./run.sh` |
| 218 | +- publish `Sysbench_Performance.res` via `send-to-lava.sh` |
| 219 | + |
| 220 | +Keep `CSV_FILE` empty by default (to avoid extra artifacts) and enable only when you explicitly need CSV. |
| 221 | + |
| 222 | +--- |
| 223 | + |
| 224 | +## License |
| 225 | + |
| 226 | +Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. |
| 227 | +SPDX-License-Identifier: BSD-3-Clause-Clear |
0 commit comments