How to Install and Use ioping to Measure Data Read/Write Speed on Linux
Understanding the performance of your storage devices is crucial in web hosting. Whether you’re running a dedicated server, a VPS server, or even a cloud hosting, the speed at which your server can read and write data directly impacts the performance of your applications and websites. One of the most reliable tools for measuring storage I/O performance on a Linux machine is ioping.
ioping is akin to the ping command, but instead of testing network latency, it measures the latency of storage devices. This tool is especially useful for those who manage, Apache, Nginx, or LiteSpeed servers, as these web servers rely heavily on the speed of data reads/writes.
This tutorial will show you how to install and use ioping to conduct storage I/O performance tests on Linux.
Step 1. Installing `ioping`
Before you can use ioping, you need to install it on your Linux machine:
For Debian/Ubuntu:
apt update apt install ioping
For CentOS:
yum install epel-release yum install ioping
Step 2. Basic Usage of `ioping`
Once installed, you can start using ioping to test the I/O performance of your storage device:
ioping /path/to/directory
Replace /path/to/directory with the directory you want to test. This command will send a sequence of requests to the specified directory and display the I/O latency.
For example:
ioping /tmp/
ioping /dev/vda2
See disk I/O latency using the default values and the current directory
ioping .
Step 3. Advanced Usage
To test a specific device, such as /dev/vda2
ioping -c 10 /dev/vda2
To see the disk seek rate:
ioping -R /dev/vda2
To see disk sequential speed (MiB/s)
ioping -RL /dev/vda2
How to set the interval between requests.
The default is 1 second. To change pass the -i {interval} option. Set 3 seconds:
ioping -i 3 . ioping -i 3 /dev/sdb
How do I use asynchronous I/O?
Pass the -A option:
ioping -c 6 -A /dev/vda2
How to use direct I/O (O_DIRECT).
Pass the -D option:
ioping -c 6 -D /tmp
How to use read-write ping-pong mode
Pass the -G option:
ioping -c 10 -G /tmp
How to use use sync I/O (O_SYNC)
Pass the -Y option:
ioping -c 10 -Y /dev/vda2
Getting help
Read the man page:
man ioping
OR.
ioping -h
Conclusion
One of the most reliable tools for measuring storage I/O performance on a Linux machine is ioping. We hope this article will be useful for you. Good luck!