Quit letting your disk writes stall everything
Performance Tuning & Kernel Parameters (Sysctl)
Quit letting your disk writes stall everything
🧩 The Challenge
Ever had a perfectly good server just lock up solid during a backup or a big data import, even with screaming fast SSDs? The whole system just chokes, even if top says IO wait is low. It’s infuriating, and nobody tells you why this happens.
💡 The Fix
There are a couple of kernel parameters that dictate when the system *has* to write data from RAM to disk. Tweak these values down, and your system will flush writes more often, preventing those massive, paralyzing stalls.
cat << EOF > /etc/sysctl.d/50-vm-dirty.conf
vm.dirty_ratio = 10
vm.dirty_background_ratio = 5
EOF
sysctl -p /etc/sysctl.d/50-vm-dirty.conf
⚙️ Why It Works
Linux uses a write-back cache, keeping “dirty” data in memory before writing it to disk. When that dirty cache hits a certain percentage (vm.dirty_ratio), the kernel stops everything to flush it, freezing your system. The vm.dirty_background_ratio tells it to start flushing *earlier*, in the background, so you don’t hit that hard wall.
🚀 Pro-Tip: Keep an eye on `/proc/vmstat | grep dirty` for `nr_dirty` to see how much data is waiting.
Linux Tips & Tricks | © ngelinux.com | 11/12/2026
