LinuxCommandLibrary

sysbench

Benchmark system performance

TLDR

Run a CPU benchmark with 1 thread for 10 seconds

$ sysbench cpu run
copy

Run a CPU benchmark with multiple threads for a specified time
$ sysbench --threads=[number_of_threads] --time=[seconds]
copy

Run a memory benchmark with 1 thread for 10 seconds
$ sysbench memory run
copy

Prepare a filesystem-level read benchmark
$ sysbench fileio prepare
copy

Run a filesystem-level benchmark
$ sysbench --file-test-mode=[rndrd|rndrw|rndwr|seqrd|seqrewr|seqwr] fileio run
copy

SYNOPSIS

sysbench [options] command [command-options]

PARAMETERS

--test=name
    Specifies the test to run (cpu, memory, fileio, threads, oltp).

--num-threads=N
    Sets the number of threads to use.

--max-requests=N
    Limits the number of requests to execute. (oltp)

--max-time=N
    Limits the total execution time in seconds.

--file-num=N
    Number of files to create. (fileio)

--file-total-size=SIZE
    Total size of files in bytes. (fileio)

--file-test-mode=string
    Type of I/O operations (seqwr, seqrewr, rndwr, rndrw). (fileio)

--oltp-table-size=N
    Number of rows in test table(s). (oltp)

--mysql-host=host
    MySQL server hostname. (oltp)

--mysql-user=user
    MySQL user for authentication. (oltp)

--mysql-password=password
    MySQL password for authentication. (oltp)

--mysql-db=db_name
    MySQL database name. (oltp)

prepare
    Prepares the database for oltp tests.

run
    Runs the selected benchmark.

cleanup
    Cleans up the data created from the prepare command.

DESCRIPTION

sysbench is a modular, cross-platform and multi-threaded benchmark tool designed for evaluating various system parameters. It's frequently used to assess the performance of CPU, memory, disk I/O, and database servers, particularly MySQL and PostgreSQL. Sysbench allows users to run a variety of tests, each designed to stress a particular aspect of the system. These tests include CPU performance, memory allocation and transfer speeds, file I/O, thread management, and database operations. The tool is highly configurable, enabling users to tailor the benchmarks to their specific needs and simulate real-world workloads.

Sysbench's modularity allows developers to easily extend it with custom benchmarks, making it a versatile tool for performance analysis and optimization. Results are typically presented as transactions per second (TPS), queries per second (QPS), or other relevant metrics. It is essential to understand what each benchmark actually tests when interpreting the results.

CAVEATS

The meaning of sysbench parameters sometimes depends from the selected test. Read documentation for more information

DATABASE SUPPORT

While originally designed for MySQL, sysbench now supports other databases like PostgreSQL. The OLTP (Online Transaction Processing) tests are specifically designed for database benchmarking and allow simulating various database workloads.

INTERPRETING RESULTS

Understanding the specific benchmark and its parameters is critical for proper interpretation. A high TPS for an OLTP benchmark indicates good database performance under transactional workloads. Similarly, a high rate of file I/O operations indicates strong disk performance. Always consider the limitations of each test when evaluating results.

HISTORY

Sysbench was originally developed by Peter Zaitsev and Alexey Kopytov with the primary focus on benchmarking MySQL databases. Over time, it has evolved to include support for other database systems and general system benchmarking. The development has been driven by the need for a flexible and reliable tool to assess the performance of database servers under varying workloads. The tool is now actively maintained, with ongoing efforts to add new features and improve existing ones. Its usage has extended beyond database benchmarking to include general system performance evaluation in diverse environments.

SEE ALSO

stress(1), dd(1), perf(1)

Copied to clipboard