SWAP usage too high after upgrading RAM

Solution 1:

Hope you're doing great.

You have 17.7GB in Available Memory.

Linux uses all the non used memory to optimize IO, so for buffers/cache, this doesn't mean that your system does not have available memory.

So you have: 32GB in total, free 1.6GB, used by apps 13.6GB and 16.6GB in buffers/cached. Most of the buffers/cache can be used by the system when needed. The memory that really can be used is the MemAvailable, which is displayed as 17.7GB.

Run commands like:

free -h

For more clarity.

I think your problem is you have the default Swappiness value, 60, so the swap will be started to be used when you reach approximately 60% of RAM memory in use.

You can check this value with:

$ sysctl vm.swappiness
vm.swappiness = 60

Using swap normally is slow, cause accessing the drives is much more slower.

In my cloud systems and workstations I don't use swap, and if I use for whatever reason I set swappiness to values 1 or 10.

To do it until you restart the computer you can set this Kernel parameter by doing:

sudo sysctl vm.swappiness=10

You can then disable swap and enable it again.

sudo swapoff

and reenable again

sudo swapon -a

Your computer will fly again. :)

Cheers