Many times we face a situation when our Ubuntu Netbook becomes pretty slow. And when we check out our RAM, we find that only half of our RAM is used and the SWAP memory usage is gone upto 25% or 50% or even more. Confused??
Swap memory is used as an alternative to RAM. It is a small partition in the hard disk, that is used to give your system extra memory when your RAM is full. However, it is not as efficient as RAM and quite slow.
By default the swappiness is set to 60 for Ubuntu. Here is a explanation for swappiness from Ubuntu Wiki:
The swappiness parameter controls the tendency of the kernel to move processes out of physical memory and onto the swap disk. Because disks are much slower than RAM, this can lead to slower response times for system and applications if processes are too aggressively moved out of memory.
Swappiness have values between 0 to 100. If it is zero it will fully utilize your RAM before using any swap memory. If it is 100 your system will use negligible RAM. The default value of swappiness in Ubuntu is 60. Now you know, why your system uses only half of your system RAM.
Well lets take care of it. A swappiness of 10 is recommended but you can keep it to 0 too. This is how we are going to reduce swappiness to 10.
Enter the following command in your terminal to check your swapiness:
It will return some values like 60 or 10 or whatever the value is.
To change the swappiness type this command:
gksudo gedit /etc/sysctl.conf
It will open a text configuration file. Search for vm.swappiness and change its value as desired. If vm.swappiness does not exist, add it to the end of the file like so:
Save the file and Restart your system. Now you won't have any slow downs as now less memory will be moved to the swap disk.
If you are not comfortable with all these tweaks and want a simple way for this, there is an alternative.
Download Ailurus from here (download .deb for Ubuntu). It is an excellent tweaking utility for Ubuntu and you won't need to use terminal for it.
Here is a screenshot:
Restart your system after you change it. This tweak can be used for Ubuntu Desktop Edition also. For more information go to https://help.ubuntu.com/community/SwapFaq
Many of the Ubuntu Users may already know it. But this for those who are still new to Ubuntu or have less geeky (or whatever you call it) knowledge about Ubuntu.