Site icon New Generation Enterprise Linux

Stop your disk I/O from stuttering when writeback flushes take over

Performance Monitoring & Tuning

Stop your disk I/O from stuttering when writeback flushes take over

Technical Briefing | 7/22/2026

You are running a database or a high-traffic logging service, and suddenly, the whole box hits a wall. Latency spikes, your application threads block on simple reads, and iostat shows the disk is saturated, but the actual throughput is pitiful. I have spent many nights staring at this behavior. It is almost always the kernel writeback cache mechanism deciding it is time to dump dirty pages to disk all at once, effectively choking your I/O subsystem until it catches up.

Why the default dirty ratios are often too high for modern SSDs

The kernel keeps track of dirty memory pages and lets them build up before flushing them to storage. The default thresholds in /proc/sys/vm are often tuned for spinning rust from a decade ago. If you have 64GB of RAM, the default allows a massive amount of data to sit in dirty memory. When the pressure finally trips the hard limit, the kernel starts a massive synchronous write operation that kills your IOPS for everything else.

sysctl -w vm.dirty_background_bytes=67108864 && sysctl -w vm.dirty_bytes=268435456
  • Use dirty_background_bytes to force background flushes earlier so you avoid hitting the hard stall
  • Limit vm.dirty_bytes to keep the total pending write volume small enough that it does not overwhelm your controller
  • Always verify your changes persist across reboots via sysctl.conf, or they will vanish after a kernel upgrade

Do not just copy these values blindly. If you have an incredibly fast NVMe drive, you might actually want the buffers to be larger, not smaller. The trick is to ensure your background flush threshold is low enough that the kernel handles the throughput in a steady stream rather than a destructive deluge. If you are still seeing stutters, check your block device scheduler and make sure you are not using mq-deadline when kyber or none might be the better choice for your specific storage hardware.

Next time your latency metrics look like a jagged saw blade, peek at /proc/meminfo to see how many pages are listed as Dirty. If that number correlates with your performance drops, you know exactly where to start turning the knobs.

Linux Admin Automation  |  © www.ngelinux.com  |  7/22/2026
0 0 votes
Article Rating
Exit mobile version