Performance Tuning & Kernel Parameters (Sysctl)
Stop your server from hanging during big memory copies
🧩 The Challenge
Dealing with a production database server that suddenly locks up for seconds at a time while the kernel struggles to dump dirty data to disk is infuriating. It feels like the whole machine is hitting a brick wall during these spikes.
💡 The Fix
Lowering the dirty background ratio forces the kernel to start trickling writes to disk earlier, preventing that massive, blocking flush at the end. You’ll smooth out your disk latency spikes immediately.
sysctl -w vm.dirty_background_ratio=5
sysctl -w vm.dirty_ratio=10
⚙️ Why It Works
Setting these parameters lower prevents the OS from hoarding too much modified data in RAM before realizing it has to perform a massive sync operation that freezes your I/O.
🚀 Pro-Tip: Check your current values with sysctl -a | grep dirty before you touch anything so you have a rollback plan.
Linux Tips & Tricks | © ngelinux.com | 7/25/2026
