How to benchmark disk on linux


Check I / O read and write speed


Hard disk I / O read and write speed greatly affects the server's performance. The higher the data read and write speed, the smoother your server will operate. Like your computer, if replacing a better read and write SSD, it will boot faster.


To test hard disk speed on Linux VPS / Server we use the dd command:



dd if=/dev/zero of=test bs=64k count=16k conv=fdatasync && rm -f test


Results on 1 server using the hard drive of a VPS:


16384+0 records in
16384+0 records out
1073741824 bytes (1.1 GB) copied, 2.23 s, 481 MB/s
You have new mail in /var/spool/mail/root

Usually, common, normal:



  • Under 50MB / s the speed is very slow, should not be used to run websever. But it can be used to test performance, because if running smoothly on a weak VPS, it is a good product.

  • From 50MB / s to 100MB / s is acceptable. This is also the average speed of a traditional HDD

  • Above 100MB / s of this speed you can use peace of mind.

  • Over 200MB / s this speed is ideal when used for VPS running the web.

  • Above 1GB / s is great, it might be using an NVME SSD


Attention: If it is Dedicated Server, when testing the speed of the hard drive, the speed is the actual speed of that hard drive. If it is VPS, the hard drive speed when tested may differ at some point, because vps are divided from 1 server, so there will be many people using them, so the I / O speed will be fast at times. slow. However, if you are a VPS tenant, you should not use VPS with I / O speeds below 200MB / s.


Measure IOPS using Fio


To test IOPS (Input / Output operation per Second) speed on linux we can use Fio tool.
On centos you can install with the following command:


yum install -y epel-release && yum install -y fio || ( apt-get update && apt-get install -y fio )

The IOPS test on VPS will check with the following specific parameters:



  • Random actions: Random write, random read and a combination of the two. For example, for the database, when accessing the system will read data from anywhere on the hard drive, which is understood as 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 to be accessed is very small, but the number of requests for retrieval is a lot. To be able to imagine, each time a user reads an article on your website is 1 time to access (read) the database with a very small amount of data, but the number of times to read (call) data is a lot.

  • Multitasking: If your website has high traffic, you may have to serve it all at once. We will measure it by simulating multiple accesses to the drive at the same time.


Test order:


Create a 4GB file, perform read / write operations simultaneously with 4KB blocksize at the rate of 75% - 25% (ie 3 read / 1 write) and perform 64 operations at the same time. The 3: 1 ratio is very popular and approximates the current database types.


fio --randrepeat=1 --ioengine=libaio --direct=1 --gtod_reduce=1 --name=tinohost --filename=tinohost --bs=4k --iodepth=64 --size=1G --readwrite=randrw --rwmixread=75 && rm -f tinohost

Result.


fio-3.1
Starting 1 process
tinohost: Laying out IO file (1 file / 4096MiB)
Jobs: 1 (f=1): [m(1)][100.0%][r=141MiB/s,w=46.4MiB/s][r=35.0k,w=11.9k IOPS][eta 00m:00s]
tinohost: (groupid=0, jobs=1): err= 0: pid=13372: Tue Sep 24 08:31:00 2019
read: IOPS=32.3k, BW=126MiB/s (132MB/s)(3070MiB/24340msec)
bw ( KiB/s): min=27296, max=166352, per=99.69%, avg=128751.04, stdev=28448.39, samples=48
iops : min= 6824, max=41588, avg=32187.71, stdev=7112.13, samples=48
write: IOPS=10.8k, BW=42.2MiB/s (44.2MB/s)(1026MiB/24340msec)
bw ( KiB/s): min= 9216, max=56336, per=99.70%, avg=43032.50, stdev=9596.56, samples=48
iops : min= 2304, max=14084, avg=10758.06, stdev=2399.16, samples=48
cpu : usr=10.86%, sys=20.68%, ctx=36849, majf=0, minf=22
IO depths : 1=0.1%, 2=0.1%, 4=0.1%, 8=0.1%, 16=0.1%, 32=0.1%, >=64=100.0%
submit : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
complete : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.1%, >=64=0.0%
issued rwt: total=785920,262656,0, short=0,0,0, dropped=0,0,0
latency : target=0, window=0, percentile=100.00%, depth=64

Run status group 0 (all jobs):
READ: bw=126MiB/s (132MB/s), 126MiB/s-126MiB/s (132MB/s-132MB/s), io=3070MiB (3219MB), run=24340-24340msec
WRITE: bw=42.2MiB/s (44.2MB/s), 42.2MiB/s-42.2MiB/s (44.2MB/s-44.2MB/s), io=1026MiB (1076MB), run=24340-24340msec

Disk stats (read/write):
vda: ios=786432/261676, merge=111/444, ticks=966183/278465, in_queue=1241796, util=91.72%

Thus, in a second, the VPS can read an average of 32,300 tasks and write an average of 10,800 tasks.


 


Tested with tocdo.netz tool


You can simply use the tool at tocdo.net using the following command:


 


curl -Lso- tocdo.net | bash

Result:


System Info
—————————————————————--
CPU model: Virtual CPU 82d9ed4018dd
Number of cores: 1
CPU frequency: 2600.000 MHz
Total size of Disk: 55.0 GB (18.0 GB Used)
Total amount of Mem: 1838 MB (1055 MB Used)
Total amount of Swap: 4095 MB (339 MB Used)
System uptime: 24 days, 1 hour 28 min
Load average: 1.42, 1.11, 0.64
OS: CentOS 7.6.1810
Arch: x86_64 (64 Bit)
Kernel: 3.10.0-957.21.3.el7.x86_64
Virt: kvm
Date: Tue Sep 24 08:49:52 UTC 2019


Disk Speed
—————————————————————--
dd Test
I / O (1st run): 479 MB / s
I / O (2nd run): 468 MB / s
I / O (3rd run): 439 MB / s
Average: 462.0 MB / s
———————————–
Fio Test
Read performance: 75.5MB / s
Read IOPS: 18.4k
Write performance: 25.3MB / s
Write IOPS: 6172


 


 










































About My name is Nguyen Manh Cuong. I was born in a poor village in Ba Vi district, HA NOI province - windy and sunny land. Currently. https://www.nguyendiep.com/. Mr Cuong.
Newer Posts Newer Posts Older Posts Older Posts

Comments

Post a Comment