1. Overview

System testing refers to the process of running a wide range of tests to evaluate the overall performance and functionality of a system. It’s a helpful method for finding any anomalies that are preventing the system from performing at its highest level.

There are a lot of tools available on the Internet that can perform system testing on Linux. We can use them to run different tests and benchmark various components, such as the Central Processing Unit (CPU), the Graphics Processing Unit (GPU), memory, database, and more.

In this tutorial, we’ll talk about some tools that we can use to test a Linux system. We’ll learn how to install them and how to use them to analyze system components.

In terms of installation, we’ll use the apt and dnf commands as the main package managers used on many major distributions. Moreover, we have to be a root user to install these tools, so we’ll use the sudo command.

2. Sysbench

Sysbench is a multi-purpose, open-source tool that offers a straightforward way to test a Linux system. This tool includes separate tests for memory, CPU, database, I/O, and many other components.

It’s especially useful for benchmarking database performance while it’s running under a heavy load.

2.1. Installation

If we’re installing Sysbench on a Debian-based distribution such as Ubuntu, we use the apt command:

$ sudo apt install sysbench

In the case of Fedora-based distros such as RHEL, we utilize the dnf command:

$ sudo dnf install sysbench

Now, let’s see some tests using Sysbench.

2.2. Running a CPU Test

We can run a test on any system component using Sysbench with the help of a single command:

$ sysbench --test=cpu run

Here, the –test option is used to specify the component that we want to test. In this case, it has a value of cpu, which indicates that we want to check the CPU. The run command instructs Sysbench to go ahead and run the test.

When the evaluation is complete, we get the results in the form of a long output:

sysbench 1.0.18 (using system LuaJIT 2.1.0-beta3)

Running the test with following options:
Number of threads: 1
Initializing random number generator from current time

Prime numbers limit: 10000

Initializing worker threads…

Threads started!

CPU speed:
    events per second: 1023.64

General statistics:
    total time:                            10.0010s
    total number of events:                10239

Latency (ms):
        min:                                       0.97
        avg:                                       0.98
        max:                                       2.76
        95th percentile:                           0.99
        sum:                                    9996.96

Threads fairness:
    events (avg/stddev):            10239.0000/0.00
    execution time (avg/stddev):    9.9970/0.00

Visibly, the output that we’ve obtained contains a lot of information about the CPU such as speed and latency values.

2.3. Running a Memory Test

The command used in the previous section can also be utilized for running a memory test:

$ sysbench --test=memory run

Evidently, the only difference is the value of the –test option, which is memory in this case. Clearly, the latter indicates that we want to perform a memory test.

After the memory test is complete, we get an output containing potentially important memory information:

sysbench 1.0.18 (using system LuaJIT 2.1.0-beta3)

Running the test with following options:
Number of threads: 1
Initializing random number generator from current time

Running memory speed test with the following options:
  block size: 1KiB
  total size: 102400MiB
  operation: write
  scope: global

Initializing worker threads...

Threads started!

Total operations: 51156308 (5114789.88 per second)

49957.33 MiB transferred (4994.91 MiB/sec)


General statistics:
    total time:                            10.0001s
    total number of events:                51156308

Latency (ms):
        min:                                       0.00
        avg:                                       0.00
        max:                                       0.03
        95th percentile:                           0.00
        sum:                                    4492.67

Threads fairness:
    events (avg/stddev):             51156308.0000/0.00
    execution time (avg/stddev):     4.4927/0.00

Notably, we again see different latency statistics as well as general information.

2.4. Running Component Tests

The same command we already used enables us to run other tests as well. We just have to specify the value that refers to the component that we want to test.

To be clear, we can obtain the names of components for the –test option by using the –help flag of sysbench. For example, there are other several compiled-in tests:

  • cpu: CPU performance
  • memory: memory functions speed
  • fileio: file I/O
  • threads: threads subsystem performance
  • mutex: mutex performance

In general, we can also find all the command-line utilities that Sysbench offers, along with options, tests, and other features.

3. Phoronix Test Suite

Phoronix Test Suite (PTS) is a benchmarking tool that provides a large number of suites for system testing on Linux. The tests cover a wide range of components, such as CPU, memory, GPU, I/O, and others.

The process of testing a component with this tool is fairly straightforward as it manages all the aspects of a test process:

  • dependencies
  • files
  • download caches
  • installation

In terms of installation, we’ll follow a three-step process for all distributions that we’re going to discuss in this case.

3.1. Installation on Debian-Based Distros

On Debian-based distros such as Ubuntu, the first step is to download the .deb file from the official .deb link. After the download is complete, we’ll go to the download location and note the name of the file for later use.

Secondly, we use the dpkg command to install this tool, which is a package manager used on Debian-based distributions to manage .deb files:

$ sudo dpkg -i phoronix-test-suite_10.8.4_all.deb

Above, the -i option, short for –install, instructs dpkg to install PTS using its .deb file. We’ve specified the file by adding its relative path after the -i option.

Upon entering the command, the PTS installation process will commence. However, we might encounter an error during the process since the above command doesn’t install all the required dependencies. So, we might need to type another command to fix this issue and complete installing PTS:

$ sudo apt install -f

In the above command, the -f option, short for –fix-broken, fixes the dependency error by installing the remaining dependencies. Then, apt goes ahead and completes the installation of PTS.

3.2. Installation on Fedora-Based Distros

If we’re using a Fedora-based distro such as RHEL, we start by visiting the official .tar.gz link and downloading the .tar file provided by PTS. Just like in the previous case, we’ll note the name of the downloaded file for future use.

Then, we’ll use the tar command to extract the .tar file:

$ tar -xf phoronix-test-suite-10.8.4.tar.gz -C /mnt/PTS

The -f option, short for –file, is used to specify the file to be extracted, which we’ve done by typing the name of the .tar file. Additionally, we’ve used the -x option, short for –extract, to instruct tar to extract the file. We’ve also utilized the -C option, short for –directory, to specify the target directory.

Finally, we navigate to the directory where the .tar file is extracted, i.e., PTS, and install the tool:

$ cd PTS
$ sudo ./install-sh

Above, we have executed the install-sh setup file to install PTS on the system.

Next, we’ll see how to run tests using this tool.

3.3. Running a CPU Test

If we want to perform a CPU evaluation, we have to follow two steps.

The first step is to utilize the benchmark command, which we can use to specify, install, and run a particular test:

$ phoronix-test-suite benchmark sysbench

Here, we’ve specified the sysbench test, as it enables us to test memory, CPU, and many other system components.

When initiating the test, we’re prompted to specify the component that we want to test. Since we want to perform CPU benchmarking, we’ll write 1 in the terminal:

Sysbench 1.0.20:
    pts/sysbench-1.1.0
    System Test Configuration
        1: CPU
        2: RAM / Memory
        3: Test All Options
        ** Multiple items can be selected, delimit by a comma. **
        Test: 1

The test now performs a complete CPU evaluation and prints the results to the terminal upon completion:

Sysbench 1.0.20:
    pts/sysbench-1.1.0 [Test: CPU]
    Test 1 of 1
    Estimated Trial Run Count: 3
    Estimated Time To Completion: 2 Minutes [08:44 IDT]
        Started Run 1 @ 08:42:40
        Started Run 2 @ 08:44:14
        Started Run 3 @ 08:45:48
        Started Run 4 @ 08:47:22 *
        Started Run 5 @ 08:48:56 *
        Started Run 6 @ 08:50:30 *
        Started Run 7 @ 08:52:04 *
        Started Run 8 @ 08:53:38 *
        Started Run 9 @ 08:55:12 *
        Started Run 10 @ 08:56:46 *
        Started Run 11 @ 08:58:20 *
        Started Run 12 @ 08:59:54 *
        Started Run 13 @ 09:01:28 *
        Started Run 14 @ 09:03:02 *
        Started Run 15 @ 09:04:36 *

    Test: CPU:
        6102.16
        5147.57
        5272.51
        5955.3
        5900.58
        5713.5
        5815.82
        5888.94
        6006.4
        6072.04
        5935.2
        5702.08
        5801.02
        5662.42
        5600.84

    Average: 5771.76 Events Per Second
    Deviation: 4.71%
    Samples: 15

    Comparison of 3,583 OpenBenchmarking.org samples;
    median result: 15811 Events Per Second.

As we can see, we’ve got a long output containing information about the CPU.

3.4. Running a Memory Test

If we run the same command that we used in the previous section and enter 2 in the terminal when prompted, we’ll initiate a thorough memory benchmarking process:

Sysbench 1.0.20:
    pts/sysbench-1.1.0
    System Test Configuration
        1: CPU
        2: RAM / Memory
        3: Test All Options
        ** Multiple items can be selected, delimit by a comma. **
        Test: 2

After the analysis is complete, we obtain an output that includes a bunch of information about memory:

Sysbench 1.0.20:
    pts/sysbench-1.1.0 [Test: RAM / Memory]
    Test 1 of 1
    Estimated Trial Run Count: 3
    Estimated Time To Completion: 5 Minutes [06:59 IDT]
        Started Run 1 @ 06:55:20
        Started Run 2 @ 06:55:34
        Started Run 3 @ 06:55:47
        Started Run 4 @ 06:56:00 *
        Started Run 5 @ 06:56:12 *
        Started Run 6 @ 06:56:24 *
        Started Run 7 @ 06:56:36 *
        Started Run 8 @ 06:56:49 *
        Started Run 9 @ 06:57:01 *
        Started Run 10 @ 06:57:14 *
        Started Run 11 @ 06:57:26 *
        Started Run 12 @ 06:57:38 *
        Started Run 13 @ 06:57:50 *
        Started Run 14 @ 06:58:03 *

    Test: RAM / Memory:
        11140.06
        11799.17
        11674.39
        12250.95
        12572.81
        12443.42
        11739.52
        12686.26
        12161.35
        12651.1
        12313.72
        12735.01
        11677.58
        10884.97

    Average: 12052.17 MiB/sec
    Deviation: 4.83%
    Samples: 14

    Comparison of 893 OpenBenchmarking.org samples;
    median result: 6604 MiB/sec.

Since Phoronix Test Suite provides tests for almost every component, it’s a comprehensive tool to use for system testing on Linux.

4. Conclusion

In this article, we discussed some tools that help us evaluate the performance of a Linux system. We talked about their installation processes and also looked at the methods that we can use to run tests via each.

Comments are closed on this article!