Who use mostly swap memory:
for file in /proc/*/status ; do awk '/VmSwap|Name/{printf $2 " " $3}END{ print ""}' $file; done | sort -k 2 -n -r | head
ps aux --sort -rss | head
ps aux | grep php-fpm | grep -v grep | awk '{sum+=$6} END {print sum}'
sudo bash -c 'swapoff -a && swapon -a' &
First prepare file for swap:
fallocate -l 1024M /swapfile
or
dd if=/dev/zero of=/swapfile bs=1M count=1024
Change file permission:
chmod 600 /swapfile
Make swap on swapfile:
mkswap /swapfile
Turn on swap:
swapon /swapfile
Add to fstab - /etc/fstab
/swapfile none swap defaults 0 0