VMware Cloud Community
jhartman027
Contributor
Contributor
Jump to solution

Swappiness ?

Could someone please explain swappiness with regards to the Linux OS Guest? Also, what is the default setting, recommended settings if a-lot of swapping is occuring on the guest, and any other type of recommended settings. Thank You!!!!!

0 Kudos
1 Solution

Accepted Solutions
shishir08
Hot Shot
Hot Shot
Jump to solution

Linux moves memory pages that have not been accessed for some time to the swap space even if there is enough free memory available. By changing the percentage in /proc/sys/vm/swappiness you can control the swapping behavior, depending on the system configuration.

A high swappiness value means that the kernel will be more apt to unmap mapped pages. A low swappiness value means the opposite, the kernel will be less apt to unmap mapped pages. In other words, the higher the vm.swappiness value, the more the system will swap.

vm.swappiness takes a value between 0 and 100 to change the balance between swapping applications and freeing cache. At 100, the kernel will always prefer to find inactive pages and swap them out; in other cases, whether a swapout occurs depends on how much application memory is in use and how poorly the cache is doing at finding and releasing inactive items.


Tuning the Linux memory subsystem is a tough task that requires constant monitoring to ensure that changes do not negatively affect other components in the server. If you do choose to modify the virtual memory parameters , change only one parameter at a time and monitor how the server performs.

View solution in original post

0 Kudos
3 Replies
mcowger
Immortal
Immortal
Jump to solution

This isn't a VMware thing, but here's the short version.  Basically, Linux will use 'unused' memory for disk buffering and page caching.  If that memory becomes requested by an application, the OS has a decision to make - will it drop the amount of cache to service the new allocation request, or will it allocate that memory into swap?

The 'swappiness' parameter controls that decision making.

The default setting is almost ALWAYS the right one, unless you REALLY know why you are changing it.  If you are swapping, even with the default setting (which is reasonably conservative), you haven't allocated enough memory to the VM, in all liklihood (or possibly your host is WAY overcommited and is stealing memory back from the VM with the balloon driver).

--Matt VCDX #52 blog.cowger.us
jhartman027
Contributor
Contributor
Jump to solution

Thanks for your post.Smiley Happy

0 Kudos
shishir08
Hot Shot
Hot Shot
Jump to solution

Linux moves memory pages that have not been accessed for some time to the swap space even if there is enough free memory available. By changing the percentage in /proc/sys/vm/swappiness you can control the swapping behavior, depending on the system configuration.

A high swappiness value means that the kernel will be more apt to unmap mapped pages. A low swappiness value means the opposite, the kernel will be less apt to unmap mapped pages. In other words, the higher the vm.swappiness value, the more the system will swap.

vm.swappiness takes a value between 0 and 100 to change the balance between swapping applications and freeing cache. At 100, the kernel will always prefer to find inactive pages and swap them out; in other cases, whether a swapout occurs depends on how much application memory is in use and how poorly the cache is doing at finding and releasing inactive items.


Tuning the Linux memory subsystem is a tough task that requires constant monitoring to ensure that changes do not negatively affect other components in the server. If you do choose to modify the virtual memory parameters , change only one parameter at a time and monitor how the server performs.

0 Kudos