How to Benchmark Linux Servers to Choose the Best One

Server Benchmark Featured

If you need a virtual private server, or a dedicated one, you have a lot of options. And because the market is flooded and constantly evolves, there is no “best one” for everyone – or, at least, no “best one” at everything.

Some cloud providers might offer virtual private servers with the fastest storage, while their CPU power is not the greatest. Another provider might offer the best CPU performance on the market, but their storage devices are slower. Furthermore, with everyone trying to steal clients from their competition, the provider with slow storage might upgrade their devices and become the best in their market, six months later. But, with benchmarks, you can compare different providers and choose what is best for you at this moment.

A Few Words About Benchmarking

Normally, you would adapt benchmarks for your specific use case, along with hardware, and see how much you can squeeze out of your devices, their maximum performance levels. However, in this case you will run generic tests which might not squeeze out absolutely every drop of potential. But since they will run with the same parameters on the same operating system, you will get real numbers that you can easily compare and see which provider performs better or worse than another in identical situations.

Prerequisites

  • Use the latest Ubuntu stable image as the operating system. At the time of writing, this is 18.04 LTS. It doesn’t matter if you use another operating system later. This will give you a common starting point.
  • You may adapt some of the commands in this tutorial. If you do so, remember to use the exact same parameters on all servers to make a correct comparison.
  • It’s a good idea to run the same benchmark twice on each server. Some cloud providers offer inconsistent results. In this case you should avoid them altogether since it’s a sign that their guest operating system isolation is not that good, or they squeeze too many clients on the same hardware.
  • Th tutorial assumes you are logged in as root. If you’re logged in as a regular user, you need to prefix all apt commands with sudo so that something like apt update && apt install fio becomes sudo apt update && sudo apt install fio

Benchmark Server Storage

First, install the benchmarking software.

If you get a message that fio cannot be found, it means you don’t have the universe repository enabled. You can enable it with apt install software-properties-common && add-apt-repository universe and then repeat the command above to install fio.

A sequential read happens when data is read contiguously. For example, when you read a 4GB file from start to finish, it will usually show you the maximum read speed possible with your storage device and the filesystem it is currently using. You can run a sequential read test with:

If this finishes in less than twenty seconds (this usually happens if the storage is on an SSD), you should increase the size of the file being read to get more accurate results like the below line of code.

The most important numbers you should pay attention to, in this result, are READ: bw, highlighted in the following picture.

Server Benchmark Sequential Read

To test for sequential write speed, run:

Check the same numbers.

To test how your cloud storage performs under the most stressful conditions, run this test:

Just as above, increase --size if the test finishes too fast. In this case, bandwidth is less important – consider it secondary.

First, look at read: IOPS and write: IOPS.

Server Benchmark Random Readwrite

As a real-world example, the server’s storage would be stressed like this on a very busy website with a very large database that constantly has to be read and written to.

Benchmark Server CPU and Memory

Visit Geekbench’s download page. Copy the link to the latest Geekbench archive and paste it to the wget command. For example, at the time of writing this link is “http://cdn.geekbench.com/Geekbench-4.3.3-Linux.tar.gz.” The following command will download Geekbench to your server.

Extract files from the archive.

Server Benchmark Extracting Geekbench

Change to the extracted directory, which will be equivalent to the program version you found available and was output in the previous command (like in the image above).

At the time of writing the name of the executable file is geekbench4, but this may change in the future. List files in your current directory.

Server Benchmark Find Geekbench Executable Name

Run the benchmark, replacing the name of the executable, if necessary.

It will take a while until all tests are completed. At the end you will be offered a link wher eyou can see the results.

Server Benchmark Geekbench Results

Benchmark Server’s Network Bandwidth

Install Speedtest client.

Run the benchmark.

Server Benchmark Speedtest Results

Normally, the utility should find a test server as close as possible to your server. If location detection fails, you can manually list servers in your country with a command like:

Select the number from the list, and pass it to the next command like the following line of code.

Note that some servers used by speedtest might not have a lot of bandwidth available at the moment, so if the benchmark seems to return values which are too low, try a different upload/download server.

Conclusion

This covers basic benchmarking of CPU, memory, storage and network. After each test, you have numbers you can compare to choose the server which has the best values for your specific workload.

Leave a Comment

Yeah! You've decided to leave a comment. That's fantastic! Check out our comment policy here. Let's have a personal and meaningful conversation.

Sponsored Stories