How to Install and Use ioping on AlmaLinux 9 and Rocky Linux 9
Install ioping from EPEL on AlmaLinux 9 or Rocky Linux 9 and use it to measure disk latency, IOPS and sequential speed on your server.
ioping measures storage latency the way ping measures network latency: it issues small I/O requests against a directory, file or block device and prints how long each one took. It is a quick way to tell whether a VPS disk is slow or noisy before you blame the database. This guide installs ioping on AlmaLinux 9 and Rocky Linux 9 from EPEL (with the one-line equivalents for Debian and Ubuntu), shows how to build it from source, and explains the tests worth running and how to read them.
CentOS 6 reached end of life on 30 November 2020 and no longer receives updates; AlmaLinux 9, Rocky Linux 9 and CentOS Stream 9 are the current members of that family. The Google Code download that older tutorials used no longer exists either: the project lives on GitHub, and version 1.3 is packaged by the major distributions, so there is rarely a reason to compile it yourself.
Requirements
- A server running AlmaLinux 9 or Rocky Linux 9 (or Debian 13/12, Ubuntu 26.04/24.04).
- A user with
sudorights. The examples usedeploy. - A few megabytes of free space in the directory you want to test.
Install ioping from EPEL
ioping is not in the base repositories of the RHEL family; it is in EPEL (Extra Packages for Enterprise Linux). On AlmaLinux 9 and Rocky Linux 9, enable EPEL and install the package:
sudo dnf install -y epel-release
sudo dnf install -y ioping
Confirm the version:
ioping -v
EPEL 9 ships ioping 1.3. On Debian and Ubuntu the package is in the standard repositories (the universe component on Ubuntu), so one command is enough:
sudo apt update
sudo apt install -y ioping
Alternative: build from source
Use this only if you cannot enable EPEL. ioping is a single C file with no dependencies beyond the C library.
sudo dnf install -y gcc make git
git clone https://github.com/koct9i/ioping.git
cd ioping
make
sudo make install
make install places the binary in /usr/local/bin and the manual page under /usr/local/share/man.
Measure latency
ioping needs a target. Given a directory, it creates a temporary working file there, reads random 4 KiB blocks from it with the page cache bypassed, and removes the file afterwards. Test the file system that holds your data, not just /.
Basic latency test
Send ten requests to the current directory, one per second:
ioping -c 10 .
Each line shows one request; the summary at the end is what you compare between servers. This sample from the project's README shows a short run on a hard disk:
4096 bytes from . (ext4 /dev/sda3): request=1 time=0.2 ms
4096 bytes from . (ext4 /dev/sda3): request=2 time=0.2 ms
4096 bytes from . (ext4 /dev/sda3): request=3 time=0.3 ms
4096 bytes from . (ext4 /dev/sda3): request=4 time=12.7 ms
4096 bytes from . (ext4 /dev/sda3): request=5 time=0.3 ms
--- . (ext4 /dev/sda3) ioping statistics ---
5 requests completed in 4794.0 ms, 364 iops, 1.4 MiB/s
min/avg/max/mdev = 0.2/2.8/12.7/5.0 ms
Without -c the test runs until you press Ctrl+C. The first request is left out of the statistics by default because it is usually slower than the rest.
Useful variations
| Command | What it measures |
|---|---|
ioping -c 10 -s 1M /var/lib/mysql | Latency of ten 1 MiB requests on a specific file system |
ioping -R . | Random read rate (IOPS): runs for three seconds with no pause between requests |
ioping -RL . | Sequential read throughput in MiB/s, using 256 KiB requests |
ioping -W -c 10 . | Write latency; safe on a directory because only the temporary file is written |
ioping -D -c 10 . | Latency with direct I/O (O_DIRECT) |
ioping -C -c 10 . | Cached I/O: shows what applications see when the page cache helps |
ioping -c 20 -i 0.2 . | Twenty requests, 0.2 seconds apart |
Testing a block device
You can point ioping at a whole disk. Read tests are harmless and need root:
lsblk
sudo ioping -R /dev/vda
Use the device name that lsblk shows; on virtual servers it is often /dev/vda or /dev/nvme0n1 instead of /dev/sda. Never combine -W with a device or an existing file that holds data: write mode overwrites it, which is why ioping refuses to do so unless the option is repeated three times (-WWW).
Read the results
- avg is the typical latency. Compare it with the same test on another server or at another time of day rather than against an absolute target.
- max and mdev (deviation) show consistency. A low average with occasional requests that take tens or hundreds of milliseconds usually means the storage is shared and another tenant is busy, or that the device is stalling.
- iops and MiB/s are only meaningful in the
-Rmodes, where requests are sent back to back.
As a rule of thumb, solid-state storage answers 4 KiB random reads in well under a millisecond, while spinning disks need several milliseconds per seek. Run the test a few times: a single run of ten requests is a small sample.
Log latency over time
For intermittent problems, record a longer series with timestamps and look at it afterwards. This runs for one hour with a request every ten seconds:
ioping -I -i 10 -w 3600 /var/lib/mysql > ~/ioping.log
For scripts, -B prints only the final statistics as raw numbers (times in nanoseconds), and -J prints JSON:
ioping -B -c 10 .
ioping -J -c 3 .
In batch output the sixth field is the average request time in nanoseconds; man ioping documents the full field list.
Frequently asked questions
Is it safe to run ioping on a production server?
The default read test and directory write tests are light: one small request per second against a temporary file. The -R modes generate as much I/O as the disk can take for three seconds, so run them outside peak hours on a busy database server.
How is ioping different from fio or dd?
ioping answers one question, "how long does a single request take right now?", with almost no setup. fio is a full benchmark tool for modelling workloads with queue depths, mixed read/write ratios and multiple jobs. dd mostly measures sequential throughput and, without direct or sync flags, largely measures the page cache.
Why does ioping report much better numbers with -C?
With -C the kernel is allowed to serve reads from memory and writes are not flushed after each request, so you are timing RAM. The default (non-cached) mode is the one that tells you about the disk.
Does ioping work on network or ZFS file systems?
It runs on any mounted file system, but some of them cannot bypass their cache. The manual page recommends write mode (-W on a directory) for more reliable numbers on systems where non-cached reads are not supported or are cached at another level.