Saturday, August 4, 2012

How to clam down "kswapd" in Ubuntu

You might have the same issue like me seeing the "kswapd" in the top of the "top" command list every time you use VirtualBox

I found the following solution to clam down the aggressiveness of Ubuntu swapping

-----------------------------------------------------------------------------------------
1- Run the following command

gksudo gedit /etc/sysctl.conf


2- Add the following 2 lines


vm.swappiness=20

vm.vfs_cache_pressure=50


3- Reboot

-----------------------------------------------------------------------------------------

You may also switch off swapping using this command

swapoff -a





Sources:
https://wiki.archlinux.org/index.php/Maximizing_Performance#The_first_thing_to_do
https://help.ubuntu.com/community/SwapFaq#What_is_swappiness_and_how_do_I_change_it.3F








2 comments:

  1. Isnt it unsafe to turn swap off?
    What happens when you run out of memory?

    ReplyDelete
  2. Yes you are right, if you get out of memory the OS will hang


    But the option is there if you need it for a specific case or if you are testing something

    ReplyDelete