IOPS (Input/Output Operations Per Second) is the number of read and write operations a disk can complete in one second. The higher the IOPS, the faster applications run when they hit the disk often in small chunks.
For a simple brochure site IOPS barely matters, but for databases and busy services it often becomes the bottleneck sooner than the CPU or memory.
What IOPS affects
High IOPS matters most for workloads with many small disk operations:
- MySQL, PostgreSQL and MongoDB databases;
- busy web servers and online stores;
- mail servers;
- caching and queue systems.
For video streaming, backups and serving large files, the linear read and write speed matters more than IOPS, because the data flows in a continuous stream.
What IOPS depends on
Three main factors shape the result.
Drive type
NVMe drives deliver many times more IOPS than ordinary SATA SSDs, and vastly more than hard disk drives. F3 Cloud servers use NVMe SSDs.
Block size
The smaller the block, the more operations fit into a second. That is why maximum IOPS is measured with a 4 KB block, the typical size of a database request.
Access pattern
Random requests scattered across the disk are harder than sequential ones. Databases create random load.
Backups and streaming create sequential load.
Two different numbers
IOPS and linear speed in MB/s measure different things. A disk can deliver huge speed on sequential reads and noticeably lower IOPS on small random operations. When choosing a server for a database, look specifically at random IOPS with a 4 KB block.
How to measure IOPS in Linux
Measurement is done with the fio tool. Install it.
apt update && apt install -y fiodnf install -y fioThe test creates a temporary file
fio writes a file of the given size to disk, 2 GB in the examples below. Make sure there is free space and run the test in a working folder, such as /root. Delete the fiotest file afterwards.
Measure random read IOPS. This is the main figure for databases.
fio --name=randread --filename=fiotest --ioengine=libaio --direct=1 \
--rw=randread --bs=4k --iodepth=32 --numjobs=1 --size=2G \
--runtime=60 --time_based --group_reportingHere is what the keys mean:
--rw=randread– random read. Userandwritefor writes,randrwfor a mixed load;--bs=4k– a 4 KB block size;--direct=1– read past the cache, so you see the real disk and not memory;--iodepth=32– how many requests are kept in the queue at once;--runtime=60 --time_based– the test runs for exactly 60 seconds.
How to read the result
In the fio output, find the line that starts with read or write. The first value in it is the IOPS.
read: IOPS=85.2k, BW=333MiB/s (349MB/s)IOPS=85.2k is the number of operations per second.BW is the linear speed over the same time.
Below, the lat block shows latency. The lower it is, the more responsive the disk.
What else to look at
To quickly gauge the current disk load without running a test, use iostat from the sysstat package.
# Install it if the package is not there yet
apt install -y sysstat
# Refresh the stats every second; the r/s and w/s columns are operations per second
iostat -dx 1This shows the real load from your own applications in the r/s and w/s columns, and how busy the disk is in the %util column.
Our resources
Telegram channel: https://t.me/f3cloud_news
Our website: https://f3cloud.com