What is IOPS and how to check disk performance on a VPS

IOPS explained with a real fio run: block size, queue depth, flushes, safe test commands and how to measure your own disk load.

· 11 min read

Cover: what is IOPS on a VPS, how to test your disk

IOPS means input/output operations per second: how many separate read or write requests a disk completes in one second. A database fetching small rows scattered across the disk depends on it. Copying a large video depends more on throughput, the megabytes per second.

One disk has no single IOPS value. The result changes with the size of each request, whether you read or write, whether the addresses are random or sequential, and how many requests wait at once. On one of our test servers, the same virtual disk gave about 4,300 random 4 KiB reads per second in one test and about 119,000 in another. To check your own VPS, run fio, a free disk benchmarking tool for Linux, against a new test file and write those conditions down next to the number.

All benchmark figures here come from fio 3.36 on one test VPS with 2 vCPUs, 4 GB of RAM and Ubuntu 24.04, using a 1 GiB test file and 30 seconds per run. Each figure is from a single run, not an average of repeats. They are not a specification or a promise for any server.

IOPS, block size and throughput

The block size is the amount of data moved by one request. Throughput (fio calls it BW, for bandwidth) follows from the two:

throughput = IOPS × block size

In the 4 KiB random read at queue depth 1 (only one request waiting for an answer at any moment), fio reported 4281 IOPS. Multiply 4281 by 4 KiB and you get 17,124 KiB/s, or 16.7 MiB/s, which is what fio printed. At queue depth 32, the rounded 119,000 IOPS gives about 465 MiB/s against a reported 466.

Now compare that with large sequential requests:

TestBlock sizeQueue depthIOPSThroughput
Random readblock 4 KiBdepth 14281 IOPS16.7 MiB/s
Random readblock 4 KiBdepth 32119k IOPS466 MiB/s
Random writeblock 4 KiBdepth 112.1k IOPS47.3 MiB/s
Random writeblock 4 KiBdepth 32134k IOPS524 MiB/s
Sequential readblock 1 MiBdepth 163492 IOPS3493 MiB/s
Sequential writeblock 1 MiBdepth 161747 IOPS1748 MiB/s

The sequential read has fewer IOPS than even the random read at depth 1, yet it moves 7.5 times more data per second than the 119k result, because each of its operations is 256 times larger.

fio prints both binary and decimal units: 466 MiB/s is the same speed as 488 MB/s. Check which one you are comparing.

Queue depth: why one disk showed 4,300 and 119,000

Queue depth is the number of requests that have been sent and not yet finished. At depth 1 the program asks for a block, waits for it, then asks for the next. At depth 32 it keeps 32 requests in flight.

IOPS is roughly the queue depth divided by the average time one request takes.

Random 4 KiB testAverage latency (lat)Depth ÷ latencyReported IOPS
Read, depth 1latency 231.75 µsestimate about 4,300reported 4281
Read, depth 32latency 267.87 µsestimate about 119,500reported 119k
Write, depth 1latency 81.72 µsestimate about 12,200reported 12.1k
Write, depth 32latency 237.65 µsestimate about 135,000reported 134k

For reads, each request took only a little longer on average with 32 in flight, so the total rose almost 28 times. The disk path could work on many requests in parallel. Writes gained less, about 11 times, because each one slowed down from roughly 82 to 238 µs.

Which figure matters depends on your software. A script that reads records one after another behaves like depth 1, and the 119k result will not make it faster. A busy server with many independent requests can build a deeper queue.

Many applications read and write at once. With 70% reads, 30% writes and depth 32, this run gave 79.5k read IOPS and 34.1k write IOPS. The read 99th percentile was 2278 µs, about three times the 717 µs of the read-only test at the same depth, so test the mix your application really has.

How to check disk IOPS on a VPS with fio

Prepare a safe place for the test

Write tests destroy whatever is in their target. Never point --filename at a device such as /dev/sda, or at a database file, disk image or any other file you want to keep. Use a new file name in a new directory.

On Ubuntu or Debian, the commands below install fio, create the directory and check the free space on the filesystem that holds it. The directory must sit on the disk you want to measure.

sudo apt update && sudo apt install -y fio
mkdir ~/fio-test && cd ~/fio-test
df -h .

You need well over 1 GiB free. If the disk is nearly full, sort that out first; our guides cover a Docker host that filled its disk and No space left on device while space is still free.

The tests also load the disk heavily. The 30-second sequential write above wrote 51.2 GiB in total, over and over into the same 1 GiB file. Run benchmarks in a quiet window, because your site competes with them and skews the result. If the server holds data you care about, first make a tar.gz backup. Then copy the archive off the server.

Random read at depth 1

This measures how fast the disk answers small requests one at a time:

fio --name=test --filename=fio.dat --size=1G \
  --direct=1 --ioengine=libaio \
  --runtime=30 --time_based --group_reporting \
  --rw=randread --bs=4k --iodepth=1
  • --name=test names the job; the settings that follow belong to it.
  • --filename=fio.dat is the test file, created in the current directory if missing.
  • --size=1G sets how much of the file the job works on.
  • --direct=1 asks for I/O that bypasses the Linux page cache, the copy of file data kept in RAM.
  • --ioengine=libaio uses Linux asynchronous I/O, so several requests can be in flight.
  • --runtime=30 limits the test to 30 seconds.
  • --time_based keeps it running for all 30 seconds even after the whole file has been covered.
  • --group_reporting combines the report for parallel jobs; with one job it changes little.
  • --rw=randread reads from random positions.
  • --bs=4k sets a 4 KiB block.
  • --iodepth=1 keeps one request in flight.

The other tests

You do not need every variant. Pick the ones that resemble your workload, using the table under "How many IOPS do you need?" below. Keep the command and change the last line:

What you measureLast line of the command
Random read, deep queue--rw=randread --bs=4k --iodepth=32
Random write, one at a time--rw=randwrite --bs=4k --iodepth=1
Random write, deep queue--rw=randwrite --bs=4k --iodepth=32
Mixed, 70% reads--rw=randrw --rwmixread=70 --bs=4k --iodepth=32
Sequential read--rw=read --bs=1M --iodepth=16
Sequential write--rw=write --bs=1M --iodepth=16

--rwmixread sets the share of reads. read and write go through the file in order.

Cached reads and writes with fdatasync

With --direct=0, reads may be served from the page cache. If the data is already there, you are largely measuring memory. But turning direct I/O off does not guarantee cached reads. We repeated the depth 32 random read on the same server later that day, once buffered and once direct:

fio --name=test --filename=fio.dat --size=1G \
  --direct=0 --ioengine=libaio \
  --runtime=30 --time_based --group_reporting \
  --rw=randread --bs=4k --iodepth=32

The buffered run gave 4266 IOPS. The same command with --direct=1, run right after it, gave 134k (higher than the 119k in the table, which came from a separate earlier run).

Two of fio's documented defaults help explain why the cache did so little. It drops the file's cached pages before starting, and its random test normally visits each block once before repeating. The buffered run read 500 MiB of a 1 GiB file, and the disk statistics show almost as many device reads as fio requests, so few requests could have come from the cache.

The engine matters too: on Linux, libaio may only queue requests when I/O is unbuffered. In the disk statistics, in_queue divided by the run time gives about 0.9 in the buffered run and about 28.5 in the direct one. By that estimate, the buffered run kept on average about one request at the disk, not 32, and its IOPS landed close to the depth 1 result.

A normal write can return once the data is in RAM. fdatasync is the call that asks the system to push that data to storage and waits for the answer. Databases rely on this kind of flush when they confirm a transaction.

This test calls it after every 4 KiB write:

fio --name=sync --filename=fio.dat --size=1G \
  --ioengine=sync --rw=randwrite --bs=4k --fdatasync=1 \
  --runtime=30 --time_based --group_reporting

Here --ioengine=sync issues ordinary blocking calls one at a time, and --fdatasync=1 flushes after each write. The run gave 7461 write IOPS. The write call itself averaged 6.00 µs, while the sync section of the output averaged 126.44 µs with a 99th percentile of 215 µs, so nearly all the waiting happened in the flush.

direct=1 alone does not request that flush, so do not compare the 12.1k random write at depth 1 directly with the 7461 here. From inside a VPS you also cannot see every cache between your system and the physical drives.

How to read fio output

These lines are cut from the random read at depth 32; ... marks removed text:

  read: IOPS=119k, BW=466MiB/s (488MB/s)(13.6GiB/30001msec)
    slat (usec): min=2, max=1265, avg= 3.67, stdev= 2.72
    clat (usec): min=52, max=8425, avg=264.21, stdev=183.44
     lat (usec): min=54, max=8428, avg=267.87, stdev=183.41
    clat percentiles (usec):
...
     | 99.00th=[  717], 99.50th=[ 1303], 99.90th=[ 3163], 99.95th=[ 3490],
...
  IO depths    : 1=0.1%, 2=0.1%, 4=0.1%, 8=0.1%, 16=0.1%, 32=100.0%, >=64=0.0%
...
Disk stats (read/write):
  sda: ios=3562678/110, sectors=28501448/1000, merge=0/1, ticks=855722/33, in_queue=855755, util=58.24%
  • IOPS and BW are the averages for the run.
  • slat is submission latency, the time to hand the request to the kernel.
  • clat is completion latency, from submission until the answer arrives.
  • lat is the total, from the moment fio created the request.
  • 99.00th=[ 717] means 99% of requests completed within 717 µs and 1% took longer. The average hides that slow tail.
  • IO depths shows the depth fio kept on its side.

Check the unit in brackets every time. fio switches between nsec, usec and msec, and 1000 µs is 1 ms.

Do not read util as "percent of the disk's capacity used". It was 93.12% at depth 1 with 4281 IOPS and 58.24% here with 119k. It reflects time with requests outstanding, and a device that handles many in parallel can still have headroom near 100%.

When you finish, delete the test file:

rm ~/fio-test/fio.dat

How many IOPS do you need?

Two sites on the same software can need very different numbers because of data size, free RAM and queries. Use the table to choose which test resembles your task:

TaskWhat usually dominatesTest to look at first
Database with frequent commitsFlush latencyfdatasync=1 write
Database or app reading more data than fits in RAMSmall random reads4 KiB random read at queue depth 1 and 32
Backups, large downloads, media filesSequential throughput1 MiB read and write
Mixed web applicationDepends on the appRun iostat first, then the mixed test with a read share close to yours

Then measure what your workload does now. iostat comes in the sysstat package. This command prints extended disk statistics every 5 seconds, 12 times, and -y leaves out the averages since boot:

sudo apt install -y sysstat
iostat -dxy 5 12

Run it while the server is busy and find the line for your disk (sda on our test VPS). The columns to watch:

  • r/s and w/s: completed reads and writes per second; together they are most of your IOPS.
  • rkB/s and wkB/s: throughput in KiB per second.
  • rareq-sz and wareq-sz: average request size in KiB.
  • r_await and w_await: average milliseconds per request, including time in the queue.
  • aqu-sz: average queue length.
  • f/s and f_await: flush requests and their latency.

Repeat the command during several busy periods and take the highest r/s + w/s for your disk as your peak. Compare it with the fio result at a similar block size (see rareq-sz and wareq-sz) and read/write mix. After -y, each report is an average over 5 seconds, so shorter spikes are smoothed out.

Note the same columns during a normal period too. If r_await, w_await and aqu-sz climb well above those values while the application slows down, the disk deserves a closer look. If they stay about the same, search elsewhere with our checklist for a slow Linux server.

If your VPS is with HIP, run the tests on it and judge its disk by your own results rather than by the figures from our test server.

FAQ

What is a good IOPS number for a VPS?

A good number is one that covers your measured peak with acceptable latency. Compare results only when block size, read/write mix, queue depth, cache mode and file size match.

Can I check IOPS with dd?

dd copies blocks one after another, so it gives a rough idea of sequential speed at a shallow queue. It does not generate a random mixed load with a chosen depth or print latency percentiles. Use fio for IOPS.

Does ROTA=1 in lsblk mean my VPS uses a hard drive?

No. ROTA is short for rotational: lsblk -d -o NAME,ROTA shows 1 for a device the system treats as rotational. On a virtual disk this flag does not prove what hardware sits underneath. Our test disk showed ROTA=1, and that alone tells nothing about the physical drives.

Why do my fio results change between runs?

Other activity on your server or the host, caches below your system and different settings can all move the numbers. Repeat each test several times at different hours and look at the range and the 99th percentile. A 1 GiB file is also small and may fit into a cache you cannot see, so try a larger one if you have the space.