What is the swappiness value in Linux and how to modify it?

How to create an email account in Plesk?
July 14, 2019
How to increase the ulimit and file descriptors limit in linux.
July 14, 2019

What is the swappiness value in Linux and how to modify it?

It is one of feature available in Linux operating system which is responsible  degree to which the kernel prefers to swap memory to fulfil the system memory requirement. The parameter value varies from 0 to 100. In Linux system default value set to 60. A low value result kernel will try to avoid swapping unless there is almost RAM is full for process on system. The higher value would force kernel aggressively to moved out memory pages from the physical memory to swap memory.

If we set higher value then there may be negative impact on the system cause when system accessing the swap memory (which is part of the hard drive) then system operations being bit slow as compare to the RAM as RAM is faster than the hard drive. To read/write system directly on hard drive will take time so it’s best to avoid transfer active memory pages to swap memory aggressively.

To check the default value use command:

# cat /proc/sys/vm/swappiness

60

-To modify the parameter use command:

#echo 40 > /proc/sys/vm/swappiness

-To affect the changes use :

# sysctl -p

-Verify the parameter use :

# sysctl -a | grep swappiness

   vm.swappiness = 40

Comments are closed.

%d bloggers like this: