Using FIO Tool to carry out a benchmarking test on a Virtual Machine in Azure

Promise Nwachukwu
5 min readMar 27, 2021

This is a follow-up from my earlier post on Load Assessment and throughput optimization on Virtual Machines.

FIO Test

In this write up, I will take a closer look on how we can make use of the fio tool on a Linux machine on Azure.

I will be using the Standard_DS2_v2 VM size for this test and as seen in the screenshot below, this is the capacity of the VM Size size:
The VM size can support can up to 8000 IOPS and 64MBps on a disk when the host caching ([Read-only] or [Read/Write]) is enabled and when the host caching (None) is enabled on the disk, it can support up to 6400 IOPS and 96MBps.

VM Size

I will be attaching a 64Gb disk to the VM and as seen on the screenshot below this is the expected performance for this disk size:
The disk can go as far as 240 IOPS and can use a maximum throughput of 50MBps.

NB: It is very important to note that a disk can only perform as much as a VM can support. What this means is that if a VM supports a maximum of 60 MBps and the disk attached to the VM can go as far as 50 MBps, the disk will be able to function in full capacity of 50 MBps because the VM it is attached to can support that value, but if on the other hand the VM can support 60 MBps and the disk can go as far as 80 MBps, the disk will not be able to function to full capacity because the VM can’t support that value which means that the maximum the disk performance can go is the maximum the VM can support which is 60 MBps. For the disk to function at 80MBps you would need to increase the VM Size to one that can support 80MBps.

We will now run the fio tool to test the performance of the disk. I will be mounting the data disk on “/data” directory on the Linux VM.

To do this run the command below:
#mount /dev/sdc1 /data

Mounting Data Disk

You have to install the “fio” tool as well before proceeding by running this command below:
#apt-get install fio -y

Installing FIO tool

Once you have the tool installed then proceed to run the command below. For us to carry out the test, we will be increasing the block size in the command and we will take note of the changes observed.

We will be starting with a block size of 4k:
sudo fio — directory=/data — name=randrw2.dat — ioengine=libaio — iodepth=64 — rw=randwrite — bs=4k — direct=1 — size=1024M

NB: Please note that because this platform does not allow me to use double dash that is why you see the long dash on the commands. You can see the double dash better with the pictures attached below.

Output can be seen and summarized as below:
With a block size of 4k, we got an output of IOPS=3420, Bandwidth=14.0MB/s

Test with 4k block size

Explaining the result:

If you take a close look at the result obtained, you will notice we have a very high IOPS value of 3420. Now you would ask, what is the maximum expected value for this disk of 64G. From this Microsoft document , the expected maximum provisioned IOPS value should be 240 but when there is a burst, the maximum burst IOPS per disk is 3500. This explains why we are able to hit upto 3420 but not able to exceed 3500 because this is the cap for this disk size even though the VM Size it self can support upto 8000 IOPS when the disk is cached.

You would also notice that the Bandwidth we got for using a block size of 4k is 14MB/s. Looking at the picture below, you would see that the maximum provisioned Throughput/Bandwidth for 64Gb is 50 MB/s.

I believe your next question will be, how do I get that maximum value on my disk when I do the fio tool test. Well, the answer is yes, it is possible to get that value and how you can do that is by increasing the block size when you run the fio command.

Disk IOPS and Throughput Value

Testing with a block size of 1M:

Before I proceed on this, I will like to let you know that you can test with a block size of 8k, 64k before finally testing with 1M. The reason I went straight to 1M is because i know it will give me the maximum value of throughput expected.

So we proceed to run the command as seen below:
sudo fio — directory=/data — name=randrw2.dat — ioengine=libaio — iodepth=64 — rw=randwrite — bs=1M — direct=1 — size=1024M

NB: Please note that because this platform does not allow me to use double dash that is why you see the long dash on the commands. You can see the double dash better with the pictures attached below.

Output can be seen and summarized as below:

Test with 1M Block size

Explaining the result:

Looking closely at the result, you would see we have an IOPS value of 63 and a Bandwidth of 67.1MB/s. Now you see we have the IOPS value reduced but the Bandwidth Value is now increased as compared to the previous value.

If you noticed from the Microsoft document, the maximum bandwidth/throughput value expected for a 64Gb sized disk is 50 MB/s and from the results obtained now i.e. 67.1MB/s, we have been able to exceed the expected value.

What this means is that the 64Gb sized disk is performing as expected and promised by Microsoft Azure. You would also have noticed the fact that the more we increase the block size the throughput increases whereas the IOPS reduces.

I hope with this writeup you now have a better understanding on how to use the FIO tool to carry out a benchmark/performance test on a virtual machine on Azure.

References:

https://docs.microsoft.com/en-us/azure/virtual-machines/disks-benchmarks#fio

--

--