Page 1 of 1
How do I configure swappiness?
Posted: Sat Oct 29, 2016 8:13 pm
by Ashlin
I need a easy way to configure swappiness.Please help
Re: How do I configure swappiness?
Posted: Fri Nov 18, 2016 6:14 pm
by Aaron
Swappiness can be set to values between 0 and 100 inclusive. A low value causes the kernel to avoid swapping, a higher value causes the kernel to try to use swap space. The default value is 60. You can simply set the swappiness value running as root user.
To find the current swappiness settings:
To temporarily set the swappiness in Linux, write the desired value
(e.g. 30) to /proc/sys/vm/swappiness using the following command.
# Set the swappiness value as root
# Alternatively, run this
# Verify the change
# Alternatively, verify the change
- Result: vm.swappiness = 30
To make changes permanent, you can add the setting to the /etc/sysctl.conf file:
Add the below line.
# Search for the vm.swappiness setting. Uncomment and change it as necessary.
You can also clear your swap by running swapoff -a and then swapon -a as root instead of rebooting to achieve the same effect.