Tell Ubuntu to avoid using SWAP partition with swappiness setting
By default Ubuntu will move data in RAM onto the swap file/partition on the hard disk long before it runs out of memory. It will pick data that isn't accessed often but this can still be an annoying slowdown on the system. To prevent the overuse of SWAP space and speed things up all we need to do is change one setting... swappiness.
Swappiness can be set from 0 to 100. The default is 60 and the lower it is the more the computer will try to keep everything in RAM.
If you want to temporarily change the swappiness then run this command with the desired swappiness level:
Alternatively if you want the change to be permanent then edit this file:
Set swappiness to the desired level (in this case 1) by either modifying this line in the file "/etc/sysctl.conf" or if it doesn't exist, adding it at the end.
Reboot the computer for the change to take effect.
Swappiness can be set from 0 to 100. The default is 60 and the lower it is the more the computer will try to keep everything in RAM.
If you want to temporarily change the swappiness then run this command with the desired swappiness level:
sudo sysctl vm.swappiness=10
Alternatively if you want the change to be permanent then edit this file:
sudo gedit /etc/sysctl.conf
Set swappiness to the desired level (in this case 1) by either modifying this line in the file "/etc/sysctl.conf" or if it doesn't exist, adding it at the end.
vm.swappiness=1
Reboot the computer for the change to take effect.