Find out which processes are using swap
what is using my swap | swap is full which process | swap usage per process | why is the server swapping | swap | ram | procfor f in /proc/[0-9]*/status; do awk '/^Name:/ {n=$2} /^VmSwap:/ {print $2, "kB", n}' "$f"; done 2>/dev/null | sort -rn | head -15Reads the Name and VmSwap fields from /proc/<PID>/status for each process and sorts by the amount swapped out. free -h only shows that swap is in use; this command shows by whom. A lot of swapped memory for the database or php-fpm is a clear sign of too little RAM or overly generous limits.
Note: Used swap alone is not a problem, as long as vmstat 1 shows little ongoing swapping in the si and so columns.
Also searched as
- what is using my swap
- swap is full which process
- swap usage per process
- why is the server swapping