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.
- 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
aptcommands with sudo so that something like
apt update && apt install fiobecomes
sudo apt update && sudo apt install fio
Benchmark Server Storage
First, install the benchmarking software.
apt update && apt install fio
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:
fio --name=seqread --readwrite=read --direct=1 --ioengine=libaio --bs=1M --size=2000M
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.
fio --name=seqread --readwrite=read --direct=1 --ioengine=libaio --bs=1M --size=8000M
The most important numbers you should pay attention to, in this result, are
READ: bw, highlighted in the following picture.
To test for sequential write speed, run:
fio --name=seqwrite --readwrite=write --direct=1 --ioengine=libaio --bs=1M --size=2000M
Check the same numbers.
To test how your cloud storage performs under the most stressful conditions, run this test:
fio --name=randrw --readwrite=randrw --direct=1 --ioengine=libaio --bs=4k --size=200M --group_reporting --numjobs=8
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
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.
tar -xzvf *.tar.gz
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.
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.
Benchmark Server’s Network Bandwidth
Install Speedtest client.
apt install speedtest-cli
Run the benchmark.
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:
speedtest --list | grep -i germany
Select the number from the list, and pass it to the next command like the following line of code.
speedtest --server 4462
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.
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.
Our latest tutorials delivered straight to your inbox