Monday, July 23, 2018

How to Benchmark Your Linux System

https://linuxconfig.org/how-to-benchmark-your-linux-system

Objective

Use GeekBench, Sysbench, Hardinfo, and Phoronix Test Suite to benchmark your Linux system.

Distributions

This will work on most modern distributions.

Requirements

A working Linux install with root privileges.

Difficulty

Easy

Conventions

  • # - requires given linux command to be executed with root privileges either directly as a root user or by use of sudo command
  • $ - given linux command to be executed as a regular non-privileged user

Introduction

There are a bunch of reasons that you'd want to benchmark your Linux system. Most people benchmark out of pure curiosity or to measure the system's performance for games. Benchmarking can also help you identify problems with your system, though, and improve weak points for a smoother and more efficient experience. Benchmarking also helps you identify possible software issues and problematic upgrades with regressions.

There are a number of great ways to benchmark your Linux system. This guide will cover a few of the most common ones. Using any number of these will give you a good perspective of what your system can do, and where its possible weak points are.

Sysbench

Sysbench is a mutli-purpose benchmark that features tests for CPU, memory, I/O, and even database performance testing. It's a basic command line utility that offers a direct and uncomplicated way to test your system.

Install Sysbench

Start by installing Sysbench on your system. It's available from most distribution repositories.

Ubuntu/Debian
$ sudo apt install sysbench
Fedora
# dnf install sysbench
OpenSUSE
# zypper in sysbench
Arch Linux

Sysbench is available from the AUR. Go to its page, and follow your preferred procedure to install it.


CPU

Sysbench CPU Benchmark
Sysbench CPU Benchmark
All the tests are fairly straightforward. You can run the test with --test=X run. Change the run to help to get the options specific to that test. Why not start out by running the CPU test. It's probably the most common one that you'll want to check, especially if you're an overclocker.
$ sysbench --test=cpu run
The test will take a bit of time to run, and afterward, you'll see your results printed out in the terminal.

Memory

Sysbench Memory Benchmark
Sysbench Memory Benchmark
The memory test follows the exact same rules as the CPU one. Run it too.
$ sysbench --test=memory run
Once again, you'll see your results in the terminal.

I/O

Sysbench I/O Benchmark
Sysbench I/O Benchmark
The file I/O test is a little different. You also need to tell it which type of I/O test to run. You can see the available tests by running the help command for the test. A basic sequential write looks like this:
$ sysbench --test=fileio --file-test-mode=seqwr run
Just like the others, you'll see a report when it's done.


GeekBench

GeekBench is another complete test suite that's available for Linux. GeekBench automatically puts your system through a battery of tests and produces a complete set of results as well as an overall score.

You can head over to the GeekBench website, and download the latest release for Linux. GeekBench is proprietary software and comes as a set of binaries in a tarball. When it's finished downloading, unpack the tarball wherever is convenient.

GeekBench Benchmark Running
GeekBench Benchmark Running
Open a terminal in the GeekBench directory that you just unpacked, and run the binary to start your test.
$ ./geekbench4
GeekBench Benchmark Finished
GeekBench Benchmark Finished
After the test, Geekbench will give you a URL to view your complete test results.

GeekBench Benchmark Results
GeekBench Benchmark Results
The results are organized in a table, with your complete score on top. As you scroll through the table, you'll see your results on specific tests that GeekBench ran.


Hardinfo

Hardinfo is a great utility that provides both detailed system information and a series of basic benchmarks. It's open source, and it's available in most distribution's repositories.

Install Hardinfo

Ubuntu/Debian
$ sudo apt install hardinfo
Fedora

For some reason, the Fedora developers decided to stop packaging Hardinfo, so you'll need to build it yourself.

# dnf install glib-devel gtk+-devel zlib-devel libsoup-devel
$ cd Downloads
$ git clone https://github.com/lpereira/hardinfo.git
$ cd hardinfo
$ mkdir build
$ cd build
$ cmake ..
$ make
# make install
OpenSUSE
# zypper in hardinfo
Arch Linux
# pacman -S hardinfo

Using Hardinfo

Open up Hardinfo on your computer. It's a graphical utility, and it should be categorized under System by your distribution's launcher.

Hardinfo
Hardinfo
Once it's open, you'll see a listing of tabs to the left organized by category and the information contained in those tabs on the right. Feel free to click through the tabs, and check out the info about your system. There's a lot of detailed readouts that can provide some insight without the need to run a test.

The final category at the bottom of the list is "Benchmarks." There are only a handful there, but they all can be pretty useful. Click on the tab you want, and Hardinfo will run the benchmark. When it's finished, it'll display your results in the right pane.


Phoronix Test Suite

Phoronix Test Suite is a complete benchmark suite that curates loads of Linux benchmark tools under one umbrella with PHP scripts.

Installation and Graphics Tests

For information on how to install Phoronix Test Suite on your distribution and run graphics tests, check out our guide on graphics benchmarking with PTS. When you have the suite installed and working, you can move on to the rest of the tests here. The rest of these tests are just a sampling of what Phoronix Test Suite has. They're more general purpose and practical tests.

John The Ripper

John The Ripper Benchmark
John The Ripper Benchmark
John The Ripper is a classic password cracking program used by security testers, but the stress that it places on your CPU makes it an ideal program to test with. Start by installing the test.
$ phoronix-test-suite install john-the-ripper
When that finishes, run the test.
$ phoronix-test-suite run john-the-ripper
The test will run three times, and you'll see your results displayed in the terminal.

LuxMark

LuxMark is another performance test that measures both OpenCL performance of both the CPU and GPU. They're both obviously important parts of your computer as a whole, and this test is also great if you plan on using your computer for any compute tasks.
$ phoronx-test-suite install luxmark
Then run it.
$ phoronix-test-suite run luxmark


Compile Firefox

Firefox is a beast of a program. It's absolutely massive, and it takes a lot of time and system resources to compile. If you really want to test your system, especially your CPU to the max, try compiling Firefox.

$ phoronix-test-suite install compile-firefox
$ phoronix-test-suite run compile-firefox

Compress Gzip

Gzip compression is another great example of a practical test that you can conduct on your Linux system. Chances are, you use gzip on a regular basis, so measuring its performance gives you a real world way to see how your system stacks up.

$ phoronix-test-suite install compress-gzip
$ phoronix-test-suite run compress-gzip

Closing Thoughts

You now have a full set of tools to benchmark your Linux system. With these, you can accurately asses the strength of your system and its performance compared to other computers. You also have a way of rooting out the weakest links and upgrading them.

No comments:

Post a Comment