Home

Awesome

Latest Release Build Status Debian Packages RPM Packages Coverage Status License

<!-- markdown-toc start - Don't edit this section. Run M-x markdown-toc-generate-toc again -->

Table of Contents

<!-- markdown-toc end -->

sysbench

sysbench is a scriptable multi-threaded benchmark tool based on LuaJIT. It is most frequently used for database benchmarks, but can also be used to create arbitrarily complex workloads that do not involve a database server.

sysbench comes with the following bundled benchmarks:

Features

Installing from Binary Packages

Linux

The easiest way to download and install sysbench on Linux is using binary package repositories hosted by packagecloud. The repositories are automatically updated on each sysbench release. Currently x86_64, i386 and aarch64 binaries are available.

Multiple methods to download and install sysbench packages are available and described at https://packagecloud.io/akopytov/sysbench/install.

Quick install instructions:

macOS

On macOS, up-to-date sysbench packages are available from Homebrew:

# Add --with-postgresql if you need PostgreSQL support
brew install sysbench

Windows

As of sysbench 1.0 support for native Windows builds was dropped. It may be re-introduced in later releases. Currently, the recommended way to obtain sysbench on Windows is using Windows Subsystem for Linux available in Windows 10.

After installing WSL and getting into he bash prompt on Windows following Debian/Ubuntu installation instructions is sufficient. Alternatively, one can use WSL to build and install sysbench from source, or use an older sysbench release to build a native binary.

Building and Installing From Source

It is recommended to install sysbench from the official binary packages as described in Installing from Binary Packages. Below are instruction for cases when you want to use sysbench on an architecture for which no binary packages are available.

Build Requirements

Windows

As of sysbench 1.0 support for native Windows builds was dropped. It may be re-introduced in later versions. Currently, the recommended way to build sysbench on Windows is using Windows Subsystem for Linux available in Windows 10.

After installing WSL and getting into bash prompt on Windows, following Debian/Ubuntu build instructions is sufficient. Alternatively, one can build and use an older 0.5 release on Windows.

Debian/Ubuntu

    apt -y install make automake libtool pkg-config libaio-dev
    # For MySQL support
    apt -y install libmysqlclient-dev libssl-dev
    # For PostgreSQL support
    apt -y install libpq-dev

RHEL/CentOS

    yum -y install make automake libtool pkgconfig libaio-devel
    # For MySQL support, replace with mysql-devel on RHEL/CentOS 5
    yum -y install mariadb-devel openssl-devel
    # For PostgreSQL support
    yum -y install postgresql-devel

Fedora

    dnf -y install make automake libtool pkgconfig libaio-devel
    # For MySQL support
    dnf -y install mariadb-devel openssl-devel
    # For PostgreSQL support
    dnf -y install postgresql-devel

macOS

Assuming you have Xcode (or Xcode Command Line Tools) and Homebrew installed:

    brew install automake libtool openssl pkg-config
    # For MySQL support
    brew install mysql
    # For PostgreSQL support
    brew install postgresql
    # openssl is not linked by Homebrew, this is to avoid "ld: library not found for -lssl"
    export LDFLAGS=-L/usr/local/opt/openssl/lib 

Build and Install

    ./autogen.sh
    # Add --with-pgsql to build with PostgreSQL support
    ./configure
    make -j
    make install

The above will build sysbench with MySQL support by default. If you have MySQL headers and libraries in non-standard locations (and no mysql_config can be found in the PATH), you can specify them explicitly with --with-mysql-includes and --with-mysql-libs options to ./configure.

To compile sysbench without MySQL support, use --without-mysql. If no database drivers are available database-related scripts will not work, but other benchmarks will be functional.

Usage

General Syntax

The general command line syntax for sysbench is:

	  sysbench [options]... [testname] [command] 

You can use sysbench --help to display the general command line syntax and options.

General Command Line Options

The table below lists the supported common options, their descriptions and default values:

OptionDescriptionDefault value
--threadsThe total number of worker threads to create1
--eventsLimit for total number of requests. 0 (the default) means no limit0
--timeLimit for total execution time in seconds. 0 means no limit10
--warmup-timeExecute events for this many seconds with statistics disabled before the actual benchmark run with statistics enabled. This is useful when you want to exclude the initial period of a benchmark run from statistics. In many benchmarks, the initial period is not representative because CPU/database/page and other caches need some time to warm up0
--rateAverage transactions rate. The number specifies how many events (transactions) per seconds should be executed by all threads on average. 0 (default) means unlimited rate, i.e. events are executed as fast as possible0
--thread-init-timeoutWait time in seconds for worker threads to initialize30
--thread-stack-sizeSize of stack for each thread32K
--report-intervalPeriodically report intermediate statistics with a specified interval in seconds. Note that statistics produced by this option is per-interval rather than cumulative. 0 disables intermediate reports0
--debugPrint more debug infooff
--validatePerform validation of test results where possibleoff
--helpPrint help on general syntax or on a specified test, and exitoff
--verbosityVerbosity level (0 - only critical messages, 5 - debug)4
--percentilesysbench measures execution times for all processed requests to display statistical information like minimal, average and maximum execution time. For most benchmarks it is also useful to know a request execution time value matching some percentile (e.g. 95% percentile means we should drop 5% of the most long requests and choose the maximal value from the remaining ones). This option allows to specify a percentile rank of query execution times to count95
--luajit-cmdperform a LuaJIT control command. This option is equivalent to luajit -j. See LuaJIT documentation for more information

Note that numerical values for all size options (like --thread-stack-size in this table) may be specified by appending the corresponding multiplicative suffix (K for kilobytes, M for megabytes, G for gigabytes and T for terabytes).

Random Numbers Options

sysbench provides a number of algorithms to generate random numbers that are distributed according to a given probability distribution. The table below lists options that can be used to control those algorithms.

OptionDescriptionDefault value
--rand-typerandom numbers distribution {uniform, gaussian, special, pareto, zipfian} to use by default. Benchmark scripts may choose to use either the default distribution, or specify it explictly, i.e. override the default.special
--rand-seedseed for random number generator. When 0, the current time is used as an RNG seed.0
--rand-spec-iternumber of iterations for the special distribution12
--rand-spec-pctpercentage of the entire range where 'special' values will fall in the special distribution1
--rand-spec-respercentage of 'special' values to use for the special distribution75
--rand-pareto-hshape parameter for the Pareto distribution0.2
--rand-zipfian-expshape parameter (theta) for the Zipfian distribution0.8

Versioning

For transparency and insight into its release cycle, and for striving to maintain backward compatibility, sysbench will be maintained under the Semantic Versioning guidelines as much as possible.

Releases will be numbered with the following format:

<major>.<minor>.<patch>

And constructed with the following guidelines:

For more information on SemVer, please visit http://semver.org/.