Performance Tuning & Kernel Parameters (Sysctl)
Stop your server from tanking when it hits a memory pressure spike
đź§© The Challenge
You know that sick feeling when your server starts swapping like crazy and the whole box becomes a paperweight for five minutes? It’s usually because the kernel is holding onto way too much file-backed memory while the application is actually starving for RAM.
đź’ˇ The Fix
Crank up the vfs_cache_pressure parameter so the kernel gets a bit more aggressive about reclaiming those inodes and dentries instead of keeping them forever. It forces the kernel to prioritize your active application memory over cached filesystem metadata.
sysctl -w vm.vfs_cache_pressure=150
⚙️ Why It Works
Setting this above the default 100 tells the kernel to reclaim dentry and inode caches at a faster rate, which frees up just enough breathing room to keep the system responsive during high I/O bursts. You can go even higher if you are running a database on a box with millions of tiny files, but watch your disk I/O latency.
🚀 Pro-Tip: Don’t set this past 200 unless you’ve actually profiled your system, or you’ll just end up thrashing your disk controller.
Linux Tips & Tricks | © ngelinux.com | 8/12/2026
