Pinpointing a Storage Bottleneck on a Slow Production Host
System DesignModel answerLast updated
Walk through how to confirm whether disk I/O is slowing a service, find which process drives it, characterize the workload, and propose measured fixes.
Users report that a backend service has become sluggish, and you suspect the storage layer. You have shell access to the host, but you are not told what kind of disk it uses (local NVMe, SATA SSD, spinning disk, network-attached volume) or which filesystem is mounted.
Describe how you would investigate. Your answer should cover:
- How you would use system tools such as
iostatto decide whether storage is actually the bottleneck. - How you would find out which process or workload is generating the I/O.
- How you would characterize the workload (reads vs. writes, random vs. sequential, request size, concurrency, sync behavior).
- How caching and durability settings change what you observe.
- How you would decide on a fix and verify that it worked.
Avoid relying on a single universal threshold for utilization or latency. Explain how you would interpret the numbers for the storage stack you actually find.
Hints
Hint 1
Start by separating symptoms: is the application waiting on I/O (high iowait, processes in D state, high per-request latency), or is it CPU, memory, or network bound?
Hint 2
Per-device latency (await, or r_await/w_await), queue depth (aqu-sz), request size, and IOPS/throughput together tell you more than %util alone, because %util is misleading on devices that serve many requests in parallel.
Hint 3
Attribute I/O to processes with tools like pidstat -d, iotop, or biolatency/biosnoop, then use fio to reproduce the workload shape and compare against the device's known capability to see how much headroom exists.
Model answer
Easy Try it yourself first — then compare your approach, complexity and edge cases.
Approach
Treat this as a hypothesis-driven investigation: confirm the symptom, locate the pressure, attribute it, characterize it, then change one thing and re-measure.
1. Confirm storage is really the bottleneck
Check the host before touching the disk:
top/vmstat 1: look atwa(iowait), the run queue, and thebcolumn (processes blocked on I/O). High iowait alone is not proof, since it only means the CPU was idle while I/O was outstanding.ps -eo state,pid,cmd | grep '^D': many processes in uninterruptible sleep suggest they are stuck on I/O.- Rule out memory pressure (swapping,
si/so, page-cache thrashing) and network latency, which can look like storage trouble, especially on network volumes.
Then run iostat -x 1 and read the columns together:
| Metric | What it tells you |
|---|---|
r/s, w/s | IOPS split by direction |
rkB/s, wkB/s | Throughput |
r_await, w_await | Average time per request, including queue time |
aqu-sz | Average queue length |
areq-sz (or avgrq-sz) | Average request size |
%util | Fraction of time the device had at least one request in flight |
Interpretation depends on the device:
- On a single spinning disk,
%utilnear 100% with a growing queue and latency of tens of ms is real saturation. - On NVMe or SSD arrays and cloud volumes,
%utilnear 100% can occur well below true capacity, because the device handles many requests in parallel. Watch latency against the device's normal baseline and whether latency rises as load rises. - On network or cloud volumes, check provisioned IOPS and throughput limits. Flat IOPS at exactly the cap with rising latency means you are being throttled, not that the hardware is slow.
A reasonable conclusion: storage is the bottleneck if per-request latency is well above the baseline for that device, the queue grows with load, and the application's slow requests line up in time with those latency spikes.
2. Find who is responsible
pidstat -d 1for per-process read/write KB/s and I/O delay.iotop -oafor accumulated I/O by process.biosnoop/biolatency(bcc or bpftrace) for per-request latency histograms and the issuing process.lsofor/proc/<pid>/ioand/proc/<pid>/fdto see which files are involved.- Check non-obvious culprits: log rotation, backups, compaction,
fsck, antivirus, a noisy neighbor on a shared volume, or kernel writeback (kworker,jbd2).
3. Characterize the workload
Determine:
- Read/write mix and whether it changed recently.
- Random vs. sequential: small request sizes with high IOPS suggest random; large sizes with high throughput suggest sequential.
blktraceorbiosnoopgives exact offsets. - Request size and concurrency (queue depth).
- Sync behavior: heavy
fsync/fdatasync, O_DSYNC, or metadata operations (many small files, directory scans). Usestrace -c -p <pid>orperf traceto see time spent infsync,write,open.
4. Account for caching and durability
- Reads may be served from the page cache, so device metrics understate application read volume. A cache hit-rate drop (for example after a deploy that grew the working set, or memory pressure evicting pages) can suddenly push reads to the device. Check
free,/proc/meminfo, and cachestat. - Buffered writes look fast until dirty-page limits are hit; then writers are throttled and latency spikes. Check
DirtyandWritebackin/proc/meminfoand thevm.dirty_*settings. - Durable writes (
fsync, write barriers, journaling) bypass the benefit of write-back caching. Devices without power-loss-protected cache can have much higher sync latency. A service that fsyncs on every request can be bound by flush latency, not bandwidth. - Filesystem and RAID layers add overhead: journal commits, read-modify-write on RAID5/6, and write amplification on SSDs.
5. Reproduce, fix, verify
Use fio against a test file (or a non-production volume) with the same block size, read/write mix, queue depth, and sync mode to learn what the device can deliver. If the production workload sits near that ceiling, you are capacity-bound; if far below it yet latency is high, suspect contention, throttling, or a pathological access pattern.
Possible remedies, matched to the finding:
- Capacity-bound: faster or provisioned-higher volumes, more spindles, local NVMe.
- Small random I/O: batching, larger or aligned requests, better indexes, an application-level cache.
- Sync-heavy: group commit, batching fsyncs, a log device with power-loss protection, or relaxing durability only where the product allows it.
- Noisy neighbor or background job: reschedule, throttle with
ioniceor cgroupio.max. - Cache misses: add memory or reduce the working set.
Change one variable at a time, compare before/after iostat latency percentiles and the service's own p95/p99 latency, and keep the change only if the end-to-end metric improves.
Common mistakes
- Treating
%utilof 100% as proof of saturation on SSD, NVMe, or cloud volumes. - Using one fixed latency threshold for every device.
- Averaging latency and missing tail spikes; look at histograms and percentiles.
- Ignoring the page cache and writeback behavior, so benchmarks measure memory instead of storage.
- Benchmarking with a workload shape (sequential, large blocks, no fsync) unlike production.
- Blaming storage when the real cause is memory pressure, CPU, locks, or the network.