Friday, February 22, 2013

Speed up Ubuntu Linux with Swap Fine Tuning

Swapping is designed for Low memory systems. Now a days plenty of RAM space available. RAM is much faster than HDD. Swap uses Hard disk space as virtual RAM. If you reduce the usage of HDD and increase the usage of RAM will boot the performance of your system.

The parameter named  swappiness  controls the tendency of the kernel to move processes out of physical memory and onto the swap disk.

  • swappiness can have a value of between 0 and 100
  • swappiness=0 tells the kernel to avoid swapping processes out of physical memory for as long as possible
  • swappiness=100 tells the kernel to aggressively swap processes out of physical memory and move them to swap cache 
The default value of swappiness  in Ubuntu is swappiness=60.
 Reducing the default value of swappiness will probably improve overall performance for a typical Ubuntu desktop installation.
For Desktop users A value of swappiness=10 is recommended.
For Server , it is better to use swappiness=60

How to Check swappiness value
Open a terminal and type the following command
$ cat /proc/sys/vm/swappiness
How to temporarily change the swappiness value
$  sudo sysctl vm.swappiness=10

 How to permanently change the swappiness value
$ gksudo gedit /etc/sysctl.conf

change the  value of
vm.swappiness = 10

No rebooting required




2 comments:

SPK said...

Hi,

Thank you for your useful information.

How do I ensure that the said configuration is working or not ?, Is there any command to identify this ?


shibuvarkala said...

use the following command

$ free

this will show the usage of Memory and swap