How to Use Sysbench for Linux Performance Testing?

The sysbench is a useful multi-purpose tool that provides a quick benchmark performance report of the system CPU, MySQL database, memory, and I/O report of the system. This tool can provide the system’s performance detail at intensive testing conditions, such as high CPU usage, greater database load, or low free memory. This tool provides the system results using the command line quickly.

This guide will elaborate on the uses of the sysbench tool for Linux performance testing on default and high load testing conditions with these topics:

How to Use Sysbench for Linux Performance Testing?

The sysbench performs the performance tests in Linux. The sysbench is not installed by default in Linux distributions, and to install different Linux distributions, its installation commands are provided below:

For installing in Debian-based Linux distros:

$ sudo apt install sysbench

For installing in RHEL-based Linux distros and CentOS:

$ sudo yum install sysbench

For installing in Fedora:

$ dnf install sysbench

After installing the sysbench in your desired Linux distribution (in my case, Ubuntu 22.04), let’s use it to perform benchmark performance tests with certain conditions.

CPU Benchmark

To find the CPU performance of the system on current CPU working conditions with the sysbench tool, use the “CPU” with the test specifier and run the following command:

$ sysbench --test=cpu run

It takes a few seconds to show the complete system CPU performance report. The below output displays the current CPU report, including CPU speed, Latency, and Threads fairness details in only “10.0004” seconds:

This tool provides a complete performance report on default and provided conditions in a few seconds.

The default cpu max prime number limit is “10000”, which can be increased to “15000” for checking the performance of the CPU at high loads with the following command:

$ sysbench --test=cpu --cpu-max-prime=15000 run

The output shows the performance parameters on high load:

The low load and high load CPU statistics show the details of CPU performance on provided conditions. For example, the high load shows greater events per second and latency.

Memory Benchmark

We try to keep checking on memory to get the remaining and used memory details. The sysbench can be used to perform the benchmark test with the sysbench tool. To evaluate the details of the system memory in current working conditions, run this command:

$ sysbench --test=memory run

The output shows the details about the system memory in which the MiB transferred and Total operations are important parameters:

To evaluate the memory on certain working conditions such as increasing the memory block size from default “1KiB” to “1M” and keeping the total size of memory “8GB” with these options:

$ sysbench --test=memory --memory-block-size=1M --memory-total-size=8G run

The output shows different statistics from the normal conditions which show the system performance on that given conditions:

Moreover, to find the options for the “memory” test, use the following command:

$ sysbench --test=memory help

The above options are available for the memory test.

File I/O Benchmark

The system can be tested by increasing the file size to a larger number greater than the system RAM to evaluate the system performance on these given conditions. For instance, the below command increases the file size to “150GB”, and the file test mode is sequential write to perform the file I/O performance test:

$ sysbench --test=fileio --file-total-size=150G --file-test-mode=seqwr run

The output shows different parameters of the I/O performance test at given conditions in which the file operations and written MiB/s are important features of this test:

After performing the I/O performance test delete the “150GB” file created for this test using the following command:

$ sysbench --test=fileio --file-total-size=150G cleanup

The test file is deleted from the system.

To explore all the available options for the I/O performance test by using the sysbench help command is as follows:

$ sysbench --test=fileio help

Perform Complete Benchmark with Sysbech Using Shell Script

If you want to perform all the sysbench tests with the desired conditions, you can use the shell script. For example, the below bash script file is named “” and performs the CPU, File I/O, and Memory tests performance tests combined:


# CPU Benchmark
sysbench --test=cpu --cpu-max-prime=150000 run
sysbench --test=cpu --cpu-max-prime=15000 run --num-threads=4

#FILE IO Benchmark
sysbench --test=fileio --file-total-size=150G --file-test-mode=seqwr run
sysbench --test=fileio --file-total-size=150G cleanup

#MEMROY Benchmark
sysbench --test=memory --memory-block-size=1M --memory-total-size=8G run

For the execution of bash script, use following bash command:

$ bash

The output shows the File I/O performance test results:

The output shows the memory test results in the output as well:

All three tests’ performance report is listed in the output simultaneously.


The sysbench is a benchmark tool in Linux that can be used to test the system’s CPU, I/O, and memory performance. This article performs the performance tests at default system conditions and by increasing the testing conditions to evaluate the system working on those conditions.