My PC has swappiness set to 60.
cat /proc/sys/vm/swappiness
60
Even so, swap only occurred when the PC runs out of RAM. So, every time I fill the RAM, it stops responding for a while while it is swapping into its HDD.
I thought that with swappiness of 60, proximately 60% of (full size of) RAM would be mirrored on swap so it is already there when needed to be swapped out... But that is not what I am experiencing.
I've read the manual and many different answers here but none is about having swappiness on the right value and swap not occurring until the very last moment.
Contents of free -h
total used free shared buff/cache available
Mem: 15G 9,9G 266M 4,7G 5,4G 508M
Swap: 30G 3,2G 27G
swapon
:
NAME TYPE SIZE USED PRIO
/dev/dm-1 partition 30,5G 3,5G -2
free -h
andswapon
. Lower values for vm.swappiness will reduce swapping... assuming that you have enough RAM. Higher values for vm.swappiness will increase swapping... possibly better for really low RAM configurations. It can be temporarily set with the sysctl command, or edited into a conf file to be permanent. – heynnema Jan 15 '19 at 15:54top
to see more. Interminal
, trysudo sysctl vm.swappiness=80
and then run the machine for a while and see if there's any improvement. Due to more swapping, it may make it worse. If it's not better, then try the opposite... =10... a more common value when there's enough RAM. – heynnema Jan 15 '19 at 18:08top
command confirms your thought about memory hogs, and vm.swappiness tweaking doesn't help... and it may not... you'll just have to get more RAM to solve it. – heynnema Jan 15 '19 at 18:14