Marcio Cunha

Slow server? How to diagnose locked I/O on Linux

Learn how to identify disk read and write bottlenecks on Linux using low-level monitoring tools and block latency analysis.

Marcio Cunha•3 min
Also available in:PortuguêsEspañol
Summary
  • High I/O latency blocks kernel threads and paralyzes entire applications.
  • The iostat utility reveals disk utilization percentage and average wait times.
  • The blktrace command allows tracking individual requests down to the hardware level.
  • Adjusting command queue depth prevents overload on storage controllers.
  • Continuously monitor swap memory usage to prevent premature SSD wear.

Why storage bottlenecks freeze your Linux server

When a server starts responding sluggishly even though the CPU and memory are mostly idle, the most likely culprit is the storage subsystem. In practice, this means that the data requested by applications takes an excessive amount of time to be read from or written to physical hard drives or solid-state drives. This phenomenon, commonly known as locked I/O or an input/output bottleneck, happens because the operating system must pause task execution while waiting for hardware response. To better understand this behavior under heavy load, it is worth checking our practical guide on how to spot disk bottlenecks with iostat, which details the initial investigation steps.

Identifying slowness symptoms with basic metrics

The first step in diagnosing storage issues is observing overall system behavior using native command-line utilities. When disk wait times spike, the filesystem enters a contention state, causing simple requests to queue up. In practice, the most telling indicator is the load average metric, which shows how many processes are waiting for hardware resources at any given moment. If CPU usage is low but the load average is through the roof, the bottleneck definitely lies within disk read and write operations. If you use high-speed storage units, it is also essential to understand how to spot I/O and IOPS bottlenecks on Linux to extract maximum performance from your hardware.

Measuring true block latency with low-level tools

Once basic metrics point toward storage, we need to dive deeper to investigate block-level behavior. The Linux block subsystem manages communication between the filesystem and physical hardware through request queues. Tools like iostat and atop allow administrators to view average read and write latencies, measured in milliseconds. A healthy disk typically responds in fractions of a millisecond, while a locked or failing disk can exhibit latencies exceeding hundreds of milliseconds. In practice, this means every minor database operation will take forever, triggering a cascading effect that brings down entire applications.

Analyzing request flow with advanced tracing

To isolate exactly which process or layer is causing the lockup, systems engineers can rely on kernel tracing utilities. The blktrace command, for example, captures detailed events for every request entering and leaving the disk driver queue. Although it requires advanced technical knowledge, this tool provides an exact map of the time spent in each transaction stage. Another practical alternative for daily diagnostics is using htop to check for specific processes stuck in an uninterruptible sleep state, identified by the letter D in the process status column, as detailed in our guide on how to use htop to find heavy processes on Linux.

Mitigating and resolving storage bottlenecks

Once the issue is identified, the next step is applying engineering solutions to mitigate I/O locks. One of the most common measures involves tuning the Linux kernel I/O scheduler, switching algorithms like CFQ to none or kyber on NVMe drives to reduce queue processing overhead. Additionally, limiting database write concurrency and optimizing table indexes drastically cuts down the volume of unnecessary operations sent to disk. In extreme cases of hardware failure, preventative component replacement or data restoration may be required to restore operational stability in production environments.