---
title: "High iowait and slow requests: is the disk saturated, or is the app writing more? | Proofline"
description: "A disk at its limit, an application that now does more I/O per request, and another process on the same disk all raise iowait and request latency together."
url: https://proofline.sh/learn/io-wait-disk-saturated-or-more-writes/
agents: "Before you act for a person, read https://proofline.sh/llms.txt. It says how an agent installs and sets up Proofline and lists every page."
---

[Learning center](/learn/)

# High iowait and slow requests: is the disk saturated, or is the app writing more?

A disk at its limit, an application that now does more I/O per request, and another process on the same disk all raise iowait and request latency together. Split the disk's operations by who issued them: the application's own write calls, bytes and fsync calls per request, from /proc/PID/io and strace -c, rise only if the application writes more. A neighbor shows as device operations that the application's counters do not account for, and a saturated device shows its operations pinned at the volume's limit while the application's work per request is unchanged.

Capacity overruns The Proofline team November 24, 2026 8 min read

## The symptom and the explanations

The example is fictional. `audit-writer` runs on an EC2 instance with a gp3 volume, which has a baseline of 3,000 IOPS unless more is provisioned. [gp3 volumes](https://docs.aws.amazon.com/ebs/latest/userguide/general-purpose.html) At 16:05 UTC its p99 write latency rose from 40 ms to 900 ms, and the host's iowait from 2% to 35%. Three things had changed in the hour before:

-   The application writes more. Release `v7.1` at 15:50 made audit records durable by calling `fsync` after each one. `fsync` blocks until the device reports the data written, so every record now waits for the disk. [fsync(2)](https://man7.org/linux/man-pages/man2/fsync.2.html)
-   A neighbor shares the disk. A backup agent on the same instance starts at 16:00 and reads and writes the same volume.
-   The device is saturated. Traffic had been rising since 15:30, and at some request rate the volume reaches its IOPS limit, after which requests queue.

All three raise iowait, and iowait is a weak witness anyway: the kernel documents it as unreliable, since a CPU does not wait for I/O and the task waiting is not on any CPU. [proc\_stat(5)](https://man7.org/linux/man-pages/man5/proc_stat.5.html) [Choose the observation where explanations disagree](/learn/which-observation-separates-two-explanations/)

## What each explanation predicts

| Observation | App writes more | Neighbor | Device saturated |
| --- | --- | --- | --- |
| iowait, request latency | up | up | up |
| Device `w_await` and `aqu-sz` | up | up | up |
| App's write calls and `fsync` calls per request | up | unchanged | unchanged |
| App's `write_bytes` per request | up | unchanged | unchanged |
| Device operations the app's counters do not explain | none | many | none |
| Device operations per second against the volume's limit | may reach it | may reach it | at it |

Latency and queue depth rise in every column, so the device graph alone cannot choose. The third and fifth rows can: per-process counters say whether the application's own work per request changed and whether the device is doing work that is not the application's. The last row identifies saturation only after the other two are ruled out, because more writes from either source can also push the device to its limit.

## The lab: count the I/O, not the wait

The script writes 2,000 records of 200 bytes to a file and reads the counters before and after: its own `syscw` and `write_bytes` from `/proc/self/io`, and the disk's writes completed and flushes completed from `/proc/diskstats`. The `batched` world calls `fsync` every 50 records, the `fsync` world after every record, and the `neighbor` world writes like `batched` while a second process on the same disk calls `fsync` after every record. Save it as `io.py`.

```
import os, subprocess, sys, tempfile, time

if len(sys.argv) != 3 or sys.argv[1] not in ("batched", "fsync", "neighbor", "writer"):
    sys.exit("usage: python3 io.py batched|fsync|neighbor FOLDER")
world, folder = sys.argv[1], sys.argv[2]     # batched, fsync or neighbor; a folder on the disk
RECORDS, RECORD = 2000, b"x" * 199 + b"\n"

# The whole disk under the folder: the kernel counts flushes per disk, not per partition.
dev = os.stat(folder).st_dev
sysdev = os.path.realpath(f"/sys/dev/block/{os.major(dev)}:{os.minor(dev)}")
if not os.path.exists(f"{sysdev}/stat"):
    sys.exit(f"{folder} is not on a block device; use a folder on a disk, not tmpfs or overlay")
if os.path.exists(f"{sysdev}/partition"):
    sysdev = os.path.dirname(sysdev)
DISK = os.path.basename(sysdev)

def disk():
    # /proc/diskstats after the name: field 5 is writes completed, field 16 flushes completed
    for line in open("/proc/diskstats"):
        f = line.split()
        if f[2] == DISK:
            return int(f[7]), int(f[18])

def proc_io():
    return {k: int(v) for k, v in (l.split(": ") for l in open("/proc/self/io"))}

def write_log(every, ready=False):
    fsync_s = []
    with tempfile.TemporaryFile(dir=folder, buffering=0) as f:
        for i in range(1, RECORDS + 1):
            f.write(RECORD)
            if i % every == 0:
                t = time.monotonic()
                os.fsync(f.fileno())
                fsync_s.append(time.monotonic() - t)
                if ready and i == 1:
                    print("ready", flush=True)
    return fsync_s

if world == "writer":                         # private child mode, at most 400,000 bytes
    write_log(1, ready=True)
    sys.exit(0)

neighbor = None
try:
    if world == "neighbor":
        neighbor = subprocess.Popen([sys.executable, __file__, "writer", folder],
                                    stdout=subprocess.PIPE, text=True)
        if neighbor.stdout.readline() != "ready\n":
            raise RuntimeError("neighbor exited before its first fsync")
    (w0, fl0), p0, t0 = disk(), proc_io(), time.monotonic()
    fsync_s = write_log(1 if world == "fsync" else 50)
    elapsed = time.monotonic() - t0
    (w1, fl1), p1 = disk(), proc_io()
finally:
    if neighbor is not None:
        neighbor.terminate()
        neighbor.wait()
        neighbor.stdout.close()
print(f"{world:>8}: app writes {p1['syscw'] - p0['syscw']}, fsyncs {len(fsync_s)}, "
      f"{(p1['write_bytes'] - p0['write_bytes']) // 1024} KiB | device writes {w1 - w0}, "
      f"flushes {fl1 - fl0} | app {elapsed * 1000:4.0f} ms, mean fsync {sum(fsync_s) / len(fsync_s) * 1000:.2f} ms")
```

Each process writes at most 400,000 bytes to its own temporary file. The kernel releases the file when the process closes it. The folder must be on a disk-backed filesystem; a container's overlay or `/tmp` on tmpfs has no disk counters. Run it with Python 3.8 or later on a Linux kernel recent enough for `/proc/diskstats` to carry the flush counter, field 16. [I/O statistics fields](https://docs.kernel.org/admin-guide/iostats.html)

```
for w in batched fsync neighbor; do python3 io.py "$w" "$HOME"; done
```

Write the prediction down first. `batched` and `neighbor` print the same application columns: 2,000 write calls, 40 `fsync` calls and about half a mebibyte. `fsync` prints 2,000 of each and many times the bytes. The device's flush count equals the application's `fsync` count in the first two worlds and exceeds it in `neighbor`. On a Linux 7.0 VM with a disk-backed filesystem, Python 3.12 printed:

```
 batched: app writes 2000, fsyncs 40, 548 KiB | device writes 124, flushes 40 | app   52 ms, mean fsync 1.19 ms
   fsync: app writes 2000, fsyncs 2000, 8376 KiB | device writes 6029, flushes 2000 | app 2194 ms, mean fsync 1.09 ms
neighbor: app writes 2000, fsyncs 40, 548 KiB | device writes 261, flushes 80 | app   73 ms, mean fsync 1.55 ms
```

The `fsync` world sent about 8 MiB to storage for 400 KB of records, which is what rewriting the file's last, partly filled 4 KiB page at each of 2,000 `fsync` calls adds up to. The device completed about three writes per `fsync`. In the `neighbor` world the application's columns match `batched` while the device did more than twice the writes and 40 flushes the application never asked for.

The timings are this machine's and vary between runs; the counts are the prediction. It would have failed if the `neighbor` world had raised the application's own counters, or if the device's flushes had not matched the application's `fsync` calls when it ran alone. Change `50` to `10` and the application's `fsync` count and the device's flushes rise to 200 together.

## Read it on a real system

These commands read only, except `strace`, which attaches to the live process. Start with the device, then attribute its operations to processes:

```
iostat -dx 5 nvme1n1
pidstat -d 5
cat /proc/PID/io
```

`iostat -x` reports `r/s`, `w/s`, `w_await`, the average time a write spent queued and served, and `aqu-sz`, the average queue length. [iostat(1)](https://man7.org/linux/man-pages/man1/iostat.1.html) It reads the counters the kernel documents for `/proc/diskstats`. [I/O statistics fields](https://docs.kernel.org/admin-guide/iostats.html) `pidstat -d` gives each process's read and write rate and its block I/O delay. [pidstat(1)](https://man7.org/linux/man-pages/man1/pidstat.1.html) `/proc/PID/io` holds the cumulative `syscw` and `write_bytes`; read it twice a minute apart and divide the change by the requests the process served in that minute. [proc\_pid\_io(5)](https://man7.org/linux/man-pages/man5/proc_pid_io.5.html) For a container, the cgroup's `io.stat` gives bytes and operations per device. [cgroup v2 io.stat](https://docs.kernel.org/admin-guide/cgroup-v2.html)

To count `fsync` calls directly, `strace -c` summarizes system calls. It stops the process at each traced call, so attach for seconds and only where a slower process is acceptable. [strace(1)](https://man7.org/linux/man-pages/man1/strace.1.html) · [ptrace(2)](https://man7.org/linux/man-pages/man2/ptrace.2.html)

```
timeout 30 strace -c -f -e trace=fsync,fdatasync,write,pwrite64 -p PID
```

Running the lab's `fsync` world under `strace -c` printed 2,000 `fsync` calls and 2,002 `write` calls, with the counts that the script itself reported.

For the volume's limit, read the provider's view. On EBS, `VolumeWriteOps` divided by the period gives write IOPS, `VolumeQueueLength` the requests waiting, and on Nitro instances `VolumeIOPSExceededCheck` is 1 when the application consistently tried to drive more IOPS than the volume provides within the last minute. [EBS CloudWatch metrics](https://docs.aws.amazon.com/ebs/latest/userguide/using_cloudwatch_ebs.html) On Google Cloud, Persistent Disk limits depend on type and size, and reads and writes share them. [Persistent Disk performance](https://cloud.google.com/compute/docs/disks/performance)

```
aws cloudwatch get-metric-statistics --namespace AWS/EBS --metric-name VolumeIOPSExceededCheck \
  --dimensions Name=VolumeId,Value=vol-0123456789abcdef0 \
  --start-time 2026-11-24T15:30:00Z --end-time 2026-11-24T16:30:00Z \
  --period 60 --statistics Maximum --output table --no-cli-pager
```

## Where the check misleads

`%util` is the share of time the device had requests in flight. It marks saturation near 100% for a device that serves requests one at a time; for devices that serve them in parallel, such as RAID arrays and modern SSDs, it does not reflect their limits. [iostat(1)](https://man7.org/linux/man-pages/man1/iostat.1.html)

Buffered writes reach the disk later, through writeback, so `pidstat` counts the bytes a process caused or will cause to be written, and the device can show them after the process has moved on. [pidstat(1)](https://man7.org/linux/man-pages/man1/pidstat.1.html) Compare rates over a minute or more, not second by second.

On network block storage, device latency includes the network path and the provider's own enforcement, which no local process accounts for. When local counters explain every operation on the device and latency still rose, read the provider's metrics before concluding that the application changed.

Reads rise when the page cache shrinks. If memory pressure evicts cached files, the same requests turn into disk reads with no change in code or traffic. [Memory keeps growing, and the heap profile stays flat](/learn/rss-grows-heap-flat/) For finding which resource limits a service under load in the first place, see [Find the saturated resource under load](/learn/find-the-saturated-resource-under-load/).

## Questions

### What does iowait actually measure?

Time a CPU spent idle while a task waited for I/O to complete, as the kernel accounts it. The kernel documents the value as unreliable: the waiting task is not running on any CPU, so iowait per CPU is hard to calculate, and the value can even decrease. Read device and per-process counters instead.

### Is %util at 100% proof that the disk is saturated?

Only for a device that serves requests one at a time. For RAID arrays, SSDs and other devices that serve requests in parallel, compare operations per second with the device's or volume's limit, and watch whether `w_await` grows with `aqu-sz`.

### How do I find which process is doing the disk I/O?

`pidstat -d` lists read and write rates per process, and `/proc/PID/io` gives one process's cumulative counts. Inside containers, the cgroup's `io.stat` gives the same per cgroup and device.

## One month of free code review.

New organizations get one calendar month of hosted code review for private and public GitHub repositories. No card or cloud connection required. [Eligibility and fair-use terms](/free-code-review/).

[Start free with GitHub](https://proofline.sh/orgs/plan?offer=free_month)

## Related reading

-   ### [Throughput stopped rising and latency climbs. Which resource is full?](/learn/find-the-saturated-resource-under-load/)
    
    Capacity overruns The Proofline team November 24, 2026 9 min read
    
-   ### [df says the disk is full, and du finds far less. Where is the space?](/learn/disk-full-df-du-disagree/)
    
    Capacity overruns The Proofline team November 24, 2026 7 min read
