This article explains how you can evaluate the system Disk and HDD/SSD Volume performance of your instance by using a shell script.
When the instance is created and if the volume is not attached to it, it has the system disk only. But if volumes are attached to the instance, it has the system disk and an HDD/SSD Volume attached to it. After reading this article, you will be able to evaluate their performance.
Please follow the steps below carefully
If you want to attach a volume to the instance, do it from here.
Set up FileZilla by executing the following steps:
Open FileZilla
Go to File > Site Manager
Click on “New Site” Give it a name as per your choice
Set “Protocol” to “SFTP (SSH File Transfer)”
Set “Host” to the “Public IP” address of your instance
Set “Logon Type” to “Key File”
Set “User” to “ubuntu”
Click Browse on “Key File” and navigate to your private key
Press Connect
Similar when connecting to the instance for the first time, you need to check and approve the Hostkey/its fingerprint
In FileZilla, you'll see two panes: the left pane shows the local files on your Local System, and the right pane shows the remote files on your Ubuntu Instance.
Then download the attached “bench.sh” script at the bottom of this article into your Local System.
Add "bench.sh" script from your Local System to your Instance
In FileZilla, navigate to the folder in your Local System where you downloaded the “bench.sh“ script file.
Drag and drop it onto the right side’s “ubuntu” (“/home/ubuntu”) folder. Wait for the upload to complete.
Info: Alternatively, you can also transfer “bench.sh“ script file from your Local System to your Instance using ‘scp' or 'rsync'
Log into the instance
Then, run “sudo apt update ; sudo apt upgrade -y“
Install ‘fio’ & ‘jq’ tool
To install 'fio', run this command into terminal: "sudo apt install fio"
What is FIO
Flexible IO Tester (Fio) is a benchmarking and workload simulation tool. It's widely used for testing the performance of storage systems, including hard disk drives (HDDs), solid-state drives (SSDs), and network-attached storage (NAS) devices.
To install 'jq', run this command into terminal: "sudo apt-get install jq"
What is JQ
jq is a lightweight and flexible command-line JSON processor. It is used for parsing, filtering and manipulating JSON data.
Type 'ls' to check, if the “bench.sh” script is available in “ubuntu” (“/home/ubuntu”) folder in the instance.
Run this command to make it executable: "chmod +x bench.sh"
If you have not attached the volume to the instance, run this command: "./bench.sh ./testfile 40GiB" (Note: you can give any name to 'testfile'). This will evaluate performance of System Disk.
If you have attached the volume to the instance, run this command: "./bench.sh /mnt/vol_a/testfile 40GiB" (Note: change '/mnt/vol_a' according to the mount point of the volume of your instance) (Note: you can give any name to 'testfile'). This will evaluate performance of HDD/SSD Volume.
To check mount point of the volume of your instance, run this command in the terminal "df -h".
Note: After executing this "./bench.sh /mnt/vol_a/testfile 40GiB" command, if you encounter this error "-bash: ./bench.sh: /bin/bash^M: bad interpreter: No such file or directory",
- Simply open “bench.sh” script in vim editor by running command "vim bench.sh" & then without entering into insert mode just type ":set ff=unix" and press enter. Then type ":wq" and press enter.
- After this you will be able to run "./bench.sh /mnt/vol_a/testfile 40GiB" command.
Wait for 7 to 10 minutes, you will get the results of performance of System Disk or HDD/SSD volume.
To tune up performance of System Disk or HDD/SSD Volume
For System Disk:
Run this command: “sudo tune2fs -o ^journal_data /dev/mapper/vggc-root”
(Note: change "/dev/mapper/vggc-root" according to the device name of the system disk of your instance).
For HDD/SSD Volume:
Run this command: “sudo tune2fs -o ^journal_data /dev/vdb”
(Note: change "/dev/vdb" according to the device name of the volume of your instance).
To check device name of the volume, run "df -h" or you can check it in console dashboard under volume section in instance's details page.
The command “sudo tune2fs -o ^journal_data /dev/vdb” is used to modify the filesystem on a Linux disk.
tune2fs is a utility that allows you to modify the parameters of an ext2, ext3, or ext4 filesystem. The options used in the command are:
-o: Specifies the options to modify.
^journal_data: A flag indicating that the journal_data option should be turned off. The “^” symbol is used to negate the option.
/dev/vdb: The name of the block device containing the filesystem.
In this case, the command is turning off the journal_data option for the ext2, ext3, or ext4 filesystem on the /dev/vdb block device.
Then run this command: “sudo reboot”
Log into the instance again
To check the improved performance of System Disk or HDD/SSD Volume
Run this command again to check the improved performance
in case of System Disk: “./bench.sh ./testfile 40GiB”
in case of HDD/SSD Volume: "./bench.sh /mnt/vol_a/testfile 40GiB" (Note: change '/mnt/vol_a' according to the mount point of the volume of your instance)
Wait for 7 to 10 minutes, you will get results.
Compare both the results (Before and After executing the tune2fs command).
Comparison of performance of System Disk, HDD Volume and SSD Volume of the instance on Norway Data Center before & after executing tune up command
System Disk
before executing this command: sudo tune2fs -o ^journal_data /dev/mapper/vggc-root
Sequential Write (MiB/s) | 698.4462890625 |
Sequential Read (MiB/s) | 884.224609375 |
Random Write (IOPS) | 9056.911111 |
Random Read (IOPS) | 5846.255125 |
Latency Write (µs) | 4317.588551267 |
Latency Read (µs) | 949.2242310800001 |
after executing this command: sudo tune2fs -o ^journal_data /dev/mapper/vggc-root
Sequential Write (MiB/s) | 714.53515625
|
Sequential Read (MiB/s) | 897.7470703125
|
Random Write (IOPS) | 9781.963394
|
Random Read (IOPS) | 5776.768754
|
Latency Write (µs) | 4186.415519542
|
Latency Read (µs) | 929.629037468
|
HDD Volume
before executing this command: sudo tune2fs -o ^journal_data /dev/vdb
Sequential Write (MiB/s) | 145.5869140625
|
Sequential Read (MiB/s) | 217.970703125
|
Random Write (IOPS) | 2628.915349
|
Random Read (IOPS) | 123.087946
|
Latency Write (µs) | 5822.684166651
|
Latency Read (µs) | 7834.214039958
|
after executing this command: sudo tune2fs -o ^journal_data /dev/vdb
Sequential Write (MiB/s) | 537.36328125
|
Sequential Read (MiB/s) | 864.943359375
|
Random Write (IOPS) | 3235.438789
|
Random Read (IOPS) | 2449.428306
|
Latency Write (µs) | 19022.246247782
|
Latency Read (µs) | 7622.6685339860005 |
SSD Volume
before executing this command: sudo tune2fs -o ^journal_data /dev/vdb
Sequential Write (MiB/s) | 924.451171875 |
Sequential Read (MiB/s) | 874.2197265625 |
Random Write (IOPS) | 8539.515349 |
Random Read (IOPS) | 6673.249342 |
Latency Write (µs) | 3520.3314047420004 |
Latency Read (µs) | 778.104523651 |
after executing this command: sudo tune2fs -o ^journal_data /dev/vdb
Sequential Write (MiB/s) | 968.701171875 |
Sequential Read (MiB/s) | 879.6376953125 |
Random Write (IOPS) | 8748.487928 |
Random Read (IOPS) | 6636.350002 |
Latency Write (µs) | 3431.9068213180003 |
Latency Read (µs) | 789.596753422 |
Download the attached Script into your Local System.