
How to Diagnose and Fix High RAM Usage on Linux Servers
How to Diagnose and Fix High RAM Usage on Linux Servers Your server is slow and you think it's RAM. Or you got an alert saying memory is at 92%. Or your app is randomly crashing and you suspect a memory leak. Here's the systematic approach. Step 1: Check Overall Memory Usage free -h total used free shared buff/cache available Mem: 3.8Gi 3.1Gi 142Mi 45Mi 612Mi 542Mi Swap: 2.0Gi 1.4Gi 614Mi Key numbers: available : what's actually usable for new processes (not "free") Swap used : if swap > 0, you're RAM-constrained. Swapping is ~100x slower than RAM. If available < 10% of total and swap is active, you have a RAM problem. Step 2: Find Which Process Is Using RAM # Sort by memory usage ps aux --sort = -%mem | head -20 # Or with more readable output ps -eo pid,ppid,cmd,%mem,%cpu --sort = -%mem | head -20 If you want live monitoring: # top — press M to sort by memory top # htop (more readable, install if needed) htop Step 3: Investigate the Top Process # Detailed memory breakdown for a specif
Continue reading on Dev.to DevOps
Opens in a new tab




