When you got a new VPS to use, the first thing you need to do is check the hardware specifications to make sure they meet your needs. In this article, we will learn how to check the performance of VPS hard drives using Fio – a popular IOPS meter on all Linux systems. So What is fio? What is IOPS ? and How to check the read and write speed of VPS Ubuntu 20.04 hard drive with Fio
What is Fio?
FIO is a tool use to check the speed of the hard drive: the read and write speed of the hard drive, one of the important factors affecting the performance of the server. The higher the read and write speed, the smoother your server will operate. Just like your computer, if you replace it with a better SSD, it will boot faster.
Fio is a popular IOPS measurement tool on all Linux systems.
What is IOPS?
IOPS (Input/Output Operations per Second) represents the read/write speed on the hard drive in one second, the parameter indicates how many operations can be performed at the same time, the higher the IOPS, the more operations can be performed at the same time, the faster the processing speed.
How to check the read and write speed of VPS Ubuntu 20.04 hard drive with Fio
Usually, we perform the test through the dd command, writing a data file to the hard drive. This command is very popular because it is installed by default on most Linux OS versions and displays intuitive, easy-to-understand information.
dd if=/dev/zero of=test bs=64k count=16k conv=fdatasync
Why should you use Fio ?
Although testing read and write speed through the dd command is simpler, there are still many limitations such as:
- The command performs single-task operations and sequential writing. If you operate a web and database server on VPS, this number is meaningless because most applications do not perform sequential writing but read and write randomly continuously.
- Writing data to the system can be affected by caching on the server. Some providers also optimize the returned results.
- The command performs measurements in a very short period of time (a few seconds). This test period is not enough to come to a consistent conclusion.
- This command only tests the write speed of the hard drive, not the read speed, while most websites have more reads (accessing, reading news) than writes (writing, editing news).
Thus, to check the performance of the server’s hard drive, the dd command is not the best command and does not cover all the information.
Therefore, in this article, I will introduce How to check the read and write speed of VPS Ubuntu 20.04 hard drive with Fio
How to check the read and write speed of VPS Ubuntu 20.04 hard drive with Fio
FIO is a popular IOPS measurement tool on Linux systems today. To install on Ubuntu 20.04, run the command below:
apt-get update
apt-get install -y fio
The IOPS test process on VPS will check with the following specific parameters:
- Random tasks: Random write, random read and a combination of both. For example, for a database, when accessing the system, data will be read from anywhere on the hard drive, which is understood as random access (random read).
- Block size 4KB is the most ideal number and also the lowest blocksize of the system. Specifically, for database systems, source code or most other systems, the amount of data retrieved is very small but the number of requests to retrieve is very high. To visualize, each time a user reads an article on your website is 1 time to retrieve (read) the database with a very small amount of data, but the number of times to read (call) the data is very high.
- Multitasking: If your website has high traffic, it may have to serve everything at the same time. We will measure by simulating multiple accesses to the drive at the same time.
Check random read & random write simultaneously
If you simply want to compare disk performance between providers, you should use the following test case:
Create a 4GB file, perform simultaneous reading/writing with 4KB blocksize at a ratio of 75% – 25% (ie 3 reads/1 write) and perform 64 tasks at the same time. The 3:1 ratio is very popular and is close to current database types.
fio --randrepeat=1 --ioengine=libaio --direct=1 --gtod_reduce=1 --name=vps --filename=vpsrandom --bs=4k --iodepth=64 --size=4G --readwrite=randrw --rwmixread=75
It can be seen that the VPS can simultaneously perform 15.1k read operations and 5033 write operations per second. Normally, VPS using SSD hard drives can reach 40,000 reads and 10,000 writes per second
Check for random read speed
fio --randrepeat=1 --ioengine=libaio --direct=1 --gtod_reduce=1 --name=test --filename=random_read.fio --bs=4k --iodepth=64 --size=4G --readwrite=randread
As can be seen, the test server can perform 20.1k reads per second. Typically, SSD hard drives can reach up to 50,000 reads in 1 second while non-SSD hard drives are approximately 2000.
Check for random write speed
fio --randrepeat=1 --ioengine=libaio --direct=1 --gtod_reduce=1 --name=test --filename=random_write.fio --bs=4k --iodepth=64 --size=4G --readwrite=randwrite
Here is the result after the system is completed:
It can be seen that the VPS can perform 18.9k writes in 1 second. Normally, SSD hard drives can perform up to 50,000 writes in 1 second while non-SSD hard drives are approximately 2000.
The above is the article Instructions Check the read and write speed of VPS Ubuntu 20.04 hard drive with Fio, wish you a successful operation, if you have any questions about Windows/Linux VPS service, please contact us for advice and register for a free VPS account