LinuxCommandLibrary

sysbench

Multi-threaded system benchmark tool

TLDR

CPU benchmark

$ sysbench cpu run
copy
CPU benchmark with threads
$ sysbench cpu --threads=[4] run
copy
Memory benchmark
$ sysbench memory run
copy
File I/O prepare
$ sysbench fileio --file-total-size=[10G] prepare
copy
File I/O benchmark
$ sysbench fileio --file-total-size=[10G] --file-test-mode=[rndrw] run
copy
MySQL benchmark
$ sysbench oltp_read_write --mysql-host=[localhost] --mysql-user=[user] --mysql-password=[pass] --mysql-db=[test] run
copy
Cleanup files
$ sysbench fileio --file-total-size=[10G] cleanup
copy

SYNOPSIS

sysbench [test] [--threads n] [options] [prepare|run|cleanup]

DESCRIPTION

sysbench is a multi-threaded benchmarking tool for evaluating system performance across CPU, memory, file I/O, and database workloads. It provides consistent, reproducible measurements that allow meaningful comparisons between different hardware configurations, kernel versions, or tuning parameters.
The tool includes built-in test types for common benchmarks. CPU tests stress processors using prime number calculations to measure computational throughput. Memory tests measure bandwidth and latency across sequential and random access patterns. File I/O tests support multiple modes including sequential writes, sequential reads, and random read/write mixes, requiring a preparation step to create test files before running and a cleanup step afterward.
Database benchmarks simulate OLTP (Online Transaction Processing) workloads against MySQL or PostgreSQL, executing realistic mixes of select, insert, update, and delete queries. All test types support multi-threaded execution to measure how performance scales with parallelism, revealing bottlenecks and contention points. Custom Lua scripts can define additional workloads beyond the built-in tests.

PARAMETERS

cpu

CPU test.
memory
Memory test.
fileio
File I/O test.
oltp_read_write
Database OLTP test.
oltp_read_only
Read-only database test.
--threads N
Number of threads.
--time SECONDS
Test duration.
--events N
Max events.
--file-total-size SIZE
Total file size.
--file-test-mode MODE
I/O mode (seqwr, seqrd, rndrw, etc.).
--mysql-host HOST
MySQL host.
--mysql-user USER
MySQL user.
--mysql-password PASS
MySQL password.
prepare
Prepare test.
run
Run test.
cleanup
Clean up.

CAVEATS

Results depend on test parameters. Synthetic benchmarks don't reflect all workloads. File tests need disk space. Database tests need setup.

HISTORY

sysbench was created by Alexey Kopytov at MySQL AB around 2004. It became a standard tool for MySQL benchmarking and general system performance testing.

SEE ALSO

fio(1), stress-ng(1), pgbench(1), iperf(1)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community