Diagnosing high CPU and memory usage
Capture evidence while the problem is happening:
uptime
free -h
ps -eo pid,user,%cpu,%mem,stat,etime,cmd --sort=-%cpu | head -20
ps -eo pid,user,%cpu,%mem,stat,etime,cmd --sort=-%mem | head -20
vmstat 1 10
Load average includes tasks waiting for CPU or uninterruptible I/O, so high load is not automatically high CPU. Low “available” memory, active swapping, OOM-killer messages, or a rapidly growing process point to memory pressure.
journalctl -k --since today | grep -Ei 'oom|out of memory|killed process'
Identify the workload before killing it. Check application queues, logs, scheduled jobs, traffic, and recent deployments. Add resources only after determining whether the demand is legitimate and persistent.