Swap usage control

From vpsget wiki
Jump to: navigation, search

Swappiness is a Linux kernel parameter which defines the balance between swap and memory usage. Swappiness takes a value between 0 and 100 to change the balance.

0 - swap only to avoid out of memory state.

100 - forced swap.


Display the current swappiness value:

# cat /proc/sys/vm/swappiness

Set swappiness value to 20:

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

You also can define the default value in /etc/sysctl.conf:

vm.swappiness = 30