Skip to content
Latchkey

sysbench: Usage, Options & Common CI Errors

sysbench benchmarks CPU, memory, file I/O, and database OLTP workloads.

sysbench is the go-to micro-benchmark for CPU, memory, and database throughput. The database and fileio tests have a prepare/run/cleanup lifecycle that catches first-time users.

What it does

sysbench runs built-in or Lua-scripted benchmarks. cpu and memory tests are self-contained; fileio and the OLTP database tests require a prepare step to create data, a run step to measure, and a cleanup step to remove it.

Common usage

Terminal
sysbench cpu --cpu-max-prime=20000 run
sysbench memory --memory-total-size=10G run
sysbench fileio --file-test-mode=rndrw prepare
sysbench fileio --file-test-mode=rndrw --threads=4 run
sysbench fileio cleanup

Options

ItemWhat it does
cpu / memory / fileioBuilt-in test names
prepare / run / cleanupLifecycle commands (fileio, oltp)
--threads <N>Number of worker threads
--time <secs>Limit the run duration
--cpu-max-prime <N>Workload size for the cpu test

Common errors in CI

Running the fileio or OLTP run before prepare fails with "FATAL: Cannot open file ... No such file or directory" (the test data was never created) - always prepare first and cleanup after. OLTP tests need DB flags: "FATAL: unable to connect to ... Access denied" means missing --mysql-user/--mysql-password (or --pgsql-*). The very old sysbench 0.4 syntax (--test=, --num-threads=) differs from 1.x (positional test name, --threads=); a version mismatch yields "unknown option" errors. fileio leftovers fill the runner disk if cleanup is skipped.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →