Find the answer to your Linux question:
Results 1 to 2 of 2

Thread: Swappiness

Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1


    In a server farm enviroment, what is recommended for swappiness factor. I heard 60 is the default but that seems too high, 0 I think would be good but are there any pitfalls to be aware off ?

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    I generally don't futz with that, but here is a blip from The Kernel Trap web site:
    A number of Linux kernel developers recently debated "swapiness" at length on the lkml, exploring when an application should or should not be swapped out, versus reclaiming memory from the cache. Fortunately a run-time tunable is available through the proc interface for anyone needing to adapt kernel behavior to their own requirements. To tune, simply echo a value from 0 to 100 onto /proc/sys/vm/swappiness. The higher a number set here, the more the system will swap. 2.6 kernel maintainer Andrew Morton [interview] noted that on his own desktop machines he sets swapiness to 100, further explaining:

    "My point is that decreasing the tendency of the kernel to swap stuff out is wrong. You really don't want hundreds of megabytes of BloatyApp's untouched memory floating about in the machine. Get it out on the disk, use the memory for something useful."

    The other side of the argument is that if "BloatyApp" is swapped out too agressively, when the user returns to use it he has to wait for it to swap back in and thus detects a noticable delay. Rik van Riel explains, "Making the user have very bad interactivity for the first minute or so is a Bad Thing, even if the computer did run more efficiently while the user wasn't around to notice... IMHO, the VM on a desktop system really should be optimised to have the best interactive behaviour, meaning decent latency when switching applications." Andrew Morton humorously replied, "I'm gonna stick my fingers in my ears and sing 'la la la' until people tell me 'I set swappiness to zero and it didn't do what I wanted it to do'."
    So, in effect, I think you need to experiment to see what works best in your environment.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts