Posted: . At: 1:34 PM. This was 7 years ago. Post ID: 11433
Page permalink. WordPress uses cookies, or tiny pieces of information stored on your computer, to verify who you are. There are cookies for logged in users and for commenters.
These cookies expire two weeks after they are set.


Monitor disk latency with the ioping command on Linux.


How will your HDD perform under load?

Measuring disk latency on Linux is very easy if the right command is used. This useful utility makes a difficult task very simple.

Here is an example of the usage.

ubuntu ~ $ sudo ioping /dev/xvda
4.0 KiB from /dev/xvda (device 30.0 GiB): request=1 time=406 us
4.0 KiB from /dev/xvda (device 30.0 GiB): request=2 time=506 us
4.0 KiB from /dev/xvda (device 30.0 GiB): request=3 time=437 us
4.0 KiB from /dev/xvda (device 30.0 GiB): request=4 time=486 us
4.0 KiB from /dev/xvda (device 30.0 GiB): request=5 time=526 us
4.0 KiB from /dev/xvda (device 30.0 GiB): request=6 time=469 us
4.0 KiB from /dev/xvda (device 30.0 GiB): request=7 time=483 us
^C
--- /dev/xvda (device 30.0 GiB) ioping statistics ---
7 requests completed in 6.4 s, 2.1 k iops, 8.3 MiB/s
min/avg/max/mdev = 406 us / 473 us / 526 us / 37 us

This is how to set the amount of tests to run before stopping.

ubuntu ~ $ sudo ioping -c 6 /dev/xvda
4.0 KiB from /dev/xvda (device 30.0 GiB): request=1 time=446 us
4.0 KiB from /dev/xvda (device 30.0 GiB): request=2 time=484 us
4.0 KiB from /dev/xvda (device 30.0 GiB): request=3 time=559 us
4.0 KiB from /dev/xvda (device 30.0 GiB): request=4 time=522 us
4.0 KiB from /dev/xvda (device 30.0 GiB): request=5 time=575 us
4.0 KiB from /dev/xvda (device 30.0 GiB): request=6 time=667 us
 
--- /dev/xvda (device 30.0 GiB) ioping statistics ---
6 requests completed in 5.0 s, 1.8 k iops, 7.2 MiB/s
min/avg/max/mdev = 446 us / 542 us / 667 us / 70 us

Here is a sample command that will put a load on your hard drive for benchmarking.

ubuntu ~ $ time sh -c "dd if=/dev/zero of=ddfile bs=8k count=250000 && sync"; rm ddfile
^C133414+0 records in
133414+0 records out
1092927488 bytes (1.1 GB) copied, 14.0045 s, 78.0 MB/s
 
real    0m14.007s
user    0m0.000s
sys     0m0.768s

And this is the output I got when the disk is under load.

ubuntu ~ $ sudo ioping -c 6 /dev/xvda
4.0 KiB from /dev/xvda (device 30.0 GiB): request=1 time=25.9 ms
4.0 KiB from /dev/xvda (device 30.0 GiB): request=2 time=21.0 ms
4.0 KiB from /dev/xvda (device 30.0 GiB): request=3 time=9.0 ms
4.0 KiB from /dev/xvda (device 30.0 GiB): request=4 time=13.8 ms
4.0 KiB from /dev/xvda (device 30.0 GiB): request=5 time=12.0 ms
4.0 KiB from /dev/xvda (device 30.0 GiB): request=6 time=24.1 ms
 
--- /dev/xvda (device 30.0 GiB) ioping statistics ---
6 requests completed in 5.1 s, 56 iops, 226.4 KiB/s
min/avg/max/mdev = 9.0 ms / 17.7 ms / 25.9 ms / 6.3 ms

This shows that I still get OK performance, but it is obvious that even this machine suffers under high disk activity. This simple utility makes disk benchmarking very easy.


Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.