How do I measure the (read and write) speed of my VPS? ⏱️

Want clarity on the performance of your VPS? Then it is useful to find out objectively what the read and write speed is. To determine the read or write speed of your VPS, a number of useful (free) programs are available such as dd, hdparm and fio.

In this article, I explain how to use fio to measure the read and write speed of a VPS. Specifically, we are going to measure the number of IOPS and throughput.

Install FIO

Linux / FreeBSD

CentOS: sudo yum install epel-release -y && sudo yum install fio
Debian and Ubuntu: sudo apt-get update && apt-get install fio
FreeBSD: sudo pkg install fio

MacOS

To use fio, you need Brew. Not using Brew yet? Follow these steps to install Brew on macOS.

Once Brew is installed, you can install fio in the following way:

sudo brew install fio

Windows

Download the Windows installation files for fio here.


Importantly for Windows testers, there are fewer ioengines available, so in the examples below, change the ioengine to:

--ioengine=windowsaio

Using FIO to measure IOPS


Now that FIO is installed, we can get down to business. Make sure your terminal is in the correct folder since FIO tests the hard drive speed of the current folder.

Start read test to measure IOPS

fio -direct=1 -iodepth=128 -rw=randread -ioengine=libaio -bs=4k -size=1G -numjobs=1 -runtime=60 -filename=iotest -name=test

Write test startto measure IOPS

fio -direct=1 -iodepth=128 -rw=randwrite -ioengine=libaio -bs=4k -size=1G -numjobs=1 -runtime=60 -filename=iotest -name=test

Using FIO to measure throughput

Start read test to measure throughput read speed

fio -direct=1 -iodepth=128 -rw=randread -ioengine=libaio -bs=1024k -size=1G -numjobs=1 -runtime=60 -filename=iotest -name=test

Write test startto measure throughput write speed

fio -direct=1 -iodepth=128 -rw=randwrite -ioengine=libaio -bs=1024k -size=1G -numjobs=1 -runtime=60 -filename=iotest -name=test

Explanation of the parameters used

  • direct=1: Ignores the I/O buffer and writes data away directly
  • iodepth=128: Works in conjunction with ‘direct=1’ and gets us started asynchronously
  • rw=randread/write: We write or read arbitrary data
  • ioengine=libaio: The proper engine for asynchronous testing. Under Windows, this is
    --ioengine=windowsaio
  • bs=4k: The size of a test block. 4k is the recommended block size for testing IOPS. If you want to test the throughput adjust this value to 1024k
  • size=1G: The size of the test file.
  • numjobs=1: We use this to simulate 1 process. If you want to simulate multiple simultaneous processes adjust this to, say, 16 to create 16 different test files.
  • runtime=60: Specifies how long (in seconds) the test should last.
  • filename=iotest: The name of the test file
  • name=test: The friendly name of this test

Explanation of the test result

In the results of the reading test you will see below. IOPS=12.9k shows the number of IOPS and52.9MB/s the throughput.

read: IOPS=12.9k, BW=50.5MiB/s (52.9MB/s)(508MiB/10060msec)

In the results of the writing test you will see the following. IOPS=2946 shows the number of IOPS and 12.1MB/s the throughput.

write: IOPS=2946, BW=11.5MiB/s (12.1MB/s)(691MiB/60033msec); 0 zone resets

Make sure you use the right test to measure IOPS or throughput.

Hungry for news?

Subscribe to the Hosting.NL newsletter and stay informed. Your data will be used to send news, technical updates, and support articles.

Entered data is only used to send our newsletters

Newsletter