Performance Tuning & Kernel Parameters (Sysctl)
Stop your Linux kernel from hogging too much RAM for dentries
🧩 The Challenge
You ever look at free -m and wonder why your system has almost no free memory despite not actually running much? I’ve spent way too many mornings chasing ghost memory usage only to find the kernel decided to hoard directory entries like a dragon sitting on a pile of gold.
💡 The Fix
Tweak the vfs_cache_pressure parameter to tell the kernel to stop being so clingy with metadata. It makes the kernel reclaim dentries and inodes more aggressively, which keeps your memory stats honest.
sysctl -w vm.vfs_cache_pressure=150
⚙️ Why It Works
Setting this value above the default of 100 tells the kernel to prefer evicting directory cache entries over dumping application memory. Most servers handle a setting between 150 and 200 just fine without hurting performance.
🚀 Pro-Tip: Always test this on a dev node first, because pushing this number too high can make your disk I/O spike as the kernel constantly re-reads metadata.
Linux Tips & Tricks | © ngelinux.com | 8/4/2026
