In Ubuntu, the size of the swappiness value is closely related to how to use the swap partition. When swappiness is set to 0, the physical memory is used to the maximum extent, and then the swap space is used. When swappiness is set to 100, the swap partition is actively used, in addition, the data in the memory is promptly moved to the swap space. Two extremes. For Ubuntu's default settings, this value is equal to 60. We recommend that you change it to 10. I use 4G memory (i386 uses 3G) and change it
In Ubuntu, the size of the swappiness value is closely related to how to use the swap partition. When swappiness is set to 0, the physical memory is used to the maximum extent, and then the swap space is used. When swappiness is set to 100, the swap partition is actively used, in addition, the data in the memory is promptly moved to the swap space. Two extremes. For Ubuntu's default settings, this value is equal to 60. We recommend that you change it to 10. I use 4G memory (3G for i386) and change it to 0. Specifically:
1. View swappiness in your system
Cat/proc/sys/vm/swappiness
If nothing happens, you should see 60.
2. Change the value of swappiness to 0.
Sudo sysctl vm. swappiness = 0
However, this is only temporary modification. After you restart the system, the default value of 60 will be restored. Therefore, we need to do one step:
Sudo gedit/etc/sysctl. conf
Add the following line at the end of this document:
Vm. swappiness = 0
Save and restart. OK. Your settings will take effect.