The size of the swappiness value is very much associated with how the swap partition is used.
Swappiness=0 means to maximize the use of physical memory, then the swap space, swappiness=100 when the active use of the swap partition, and the memory of the data in a timely manner into the swap space.
When this parameter = 0, it means that whenever possible, try to avoid the swap process from moving out of physical memory; This parameter = 100, which tells the kernel to move data out of physical memory to the swap cache.
This value is just a "propensity" reference value for Linux to determine whether to swap memory (swap), not to say that Linux does not use memory swap space at all after setting to 0
the basic default setting for Linuxis as follows:
[Email protected] ~]# cat/proc/sys/vm/swappiness
60
In other words, when your memory is used to 100-60=40%, it starts to appear with the swap partition. As you know, the memory speed will be much faster than the disk, this will increase the system IO, at the same time create a large number of pages in the swap out, seriously affect the performance of the system, so we at the operating system level, we should use memory, to adjust the parameter.
The method of temporary adjustment is as follows: We suggest adjusting the range 1~10
[Email protected] ~]# sysctl vm.swappiness=10
Vm.swappiness = 10
[Email protected] ~]# cat/proc/sys/vm/swappiness
10
This is only a temporary adjustment method, and will return to the default settings after reboot.
If you want to make a permanent adjustment, you need to
Need to be modified in/etc/sysctl.conf, plus:
[Email protected] ~]# cat/etc/sysctl.conf
# Controls The maximum number of shared memory segments, in pages
Kernel.shmall = 4294967296
vm.swappiness=10
[Email protected] ~]# sysctl-p
This completes the modification settings!
Change Linux swappiness to increase physical memory utilization