sysbench
Benchmark system performance
TLDR
Run a CPU benchmark with 1 thread for 10 seconds
Run a CPU benchmark with multiple threads for a specified time
Run a memory benchmark with 1 thread for 10 seconds
Prepare a filesystem-level read benchmark
Run a filesystem-level benchmark
SYNOPSIS
sysbench [global_options] --test=
Where command can be prepare, run, cleanup, help, version, or list.
PARAMETERS
--test=
Specifies the benchmark test to run (e.g., cpu, fileio, memory, oltp_read_write). This is a mandatory option.
--num-threads=
Sets the number of worker threads to simulate concurrent load.
--time=
Defines the total execution time limit for the benchmark in seconds.
--events=
Sets the total number of events (transactions/operations) to execute before stopping.
--percentile=
Calculates the specified percentile (e.g., 95 for 95th percentile) for latency measurements.
--verbosity=
Controls the verbosity level of output (0=quiet, 5=debug).
--report-interval=
Prints a progress report every
--validate
Enables result validation for certain tests where applicable.
--mysql-host=
Specifies the MySQL database host. Similar options exist for PostgreSQL, Oracle, etc.
--mysql-port=
Specifies the MySQL database port.
--oltp-table-size=
(For OLTP tests) Sets the number of rows per table to be used in the benchmark database.
--oltp-tables-count=
(For OLTP tests) Sets the number of tables to create for the benchmark database.
DESCRIPTION
sysbench is a powerful, highly configurable benchmark suite designed to evaluate the performance of various hardware and software components crucial for database-intensive workloads. It is cross-platform and supports multi-threading to simulate realistic concurrent usage. Key benchmarks include CPU performance, file I/O throughput, memory bandwidth, and thread scheduler efficiency. Crucially, sysbench excels at simulating complex database workloads, such as OLTP (Online Transaction Processing), point selects, and update/delete operations, against popular relational databases like MySQL, PostgreSQL, Oracle, and others via generic ODBC. This allows administrators and developers to assess how a system will perform under stress, identify bottlenecks, and optimize configurations for maximum efficiency. It's an indispensable tool for capacity planning, performance tuning, and regression testing in database environments.
CAVEATS
Benchmarking results can be significantly influenced by system background processes, caching, and other environmental factors; therefore, it's crucial to ensure a consistent test environment and run multiple iterations for reliable data. For database benchmarks, sysbench requires a pre-configured database server and often specific Lua scripts (e.g., for OLTP workloads). The prepare command must be run to populate data before the run command. Performance in virtualized environments might differ from bare-metal systems, and careful interpretation of results is advised.
BENCHMARK TEST TYPES
sysbench supports a variety of built-in benchmark tests, including:
- cpu: Measures integer and floating-point arithmetic performance.
- fileio: Benchmarks disk I/O performance (sequential read/write, random read/write).
- memory: Tests memory transfer speeds (read/write operations).
- threads: Evaluates thread creation and context switching overhead.
- oltp_*: A suite of tests for simulating Online Transaction Processing (OLTP) workloads against databases (e.g., oltp_read_write, oltp_point_select, oltp_update_index). These tests are highly configurable via various --oltp-* options.
TYPICAL WORKFLOW
For database benchmarks (e.g., OLTP), the typical sysbench workflow involves three main steps:
- prepare: Creates and populates the necessary tables and data in the target database according to specified parameters (e.g., table size, number of tables).
- run: Executes the actual benchmark operations against the prepared data for a specified duration or number of events.
- cleanup: Removes the benchmark-created tables and data from the database.
For other tests like cpu, fileio, or memory, only the run command is generally required.
HISTORY
sysbench was initially developed by Alexey Kopytov and released as open-source under the GNU GPL. It quickly became a standard tool for evaluating the performance of systems running MySQL, later extending its capabilities to other popular relational databases like PostgreSQL and Oracle. Over its development history, sysbench has evolved significantly, adding modularity, support for complex OLTP workloads via Lua scripts, and enhanced reporting features, cementing its position as a versatile and widely-used benchmark utility in the database and system administration communities.