My personal adventures in the quest for virtual perfectness.
This post is just a reminder for me - however, there might be a thing or two for you to pick up too...
Take a look at the image below (you can click it to enlarge):
It show the swap data from a VM. Let me explain each line and why swap vanished into thin air :
Swap in - The amount of memory EVER swapped from disk IN-to memory.
Swap out - The amount of memory EVER swapped OUT of memory into disk (so that is what the .vswp file is for, by default every VM has one in its own sub-folder).
These two suggest there has been swapping going on in the past. It is a cumulative value, so when swapping occurs again - this number will grow. During this graph (timeframe of 1 hour) there was none swapping going on - so the "Latest, Maximum, Minimum and thus Average" show the same value.
Swap in rate - The amount of memory being swapped from disk into memory during a timeframe.
Swap out rate - Like swap in rate, but now from memory into disk (which is bad right - we do not want swapping).
These two actually shows you how fast swapping is going on - if you see swap in rate, performance might suffer - since the VMs memory is being read from disk. If swap out rate is active, performance might not be an issue - but its a signal you have insufficient memory (and TPS, ballooning, compression did not result in getting enough memory free). If you see both: things are bad - you do not have sufficient memory AND this VM might have bad performance!
Swapped - The actual amount of memory swapped to disk. Is this bad? No - it just might be this VM is not using those memory blocks. So it is not swapped in, so what? Will swapped be filled for ever? Could be, if the VM never touches the memory - you keep seeing swapped. Wanna get rid of swapped? Shut down the VM or migrate it to an other host. Rebooting might help too, since most OS-es will touch the memory during boot (hence the high 'active memory' during boots - not shown in this screenshot).
Swap target - The amount of memory the vmkernel wants the amount of swap to be. You can imagine swapping out to disk takes time, so 'swap target' is in a swapping event somewhat higher than 'swapped'. And also when swapping is not needed anymore (since other VM shutdown or migrated from this host OR TPS does its job, etc.), swap target can be lower than 'swapped'.
Cool huh? Again - having 'Swapped' is perfectly fine, as long as you don't see 'Swap in rate' and 'Swap out rate' at the same time - you need to take action (basically - add more memory, add hosts or less VMs in your cluster).
Why this title? Well, acording the theory: if 'Swapped target' is 0 and 'Swapped' + 'Swap in' should be 'Swap out'. In this case: 37.104 + 7.450.164 = 7.487.268 and not 7.889.416... I'm missing about 400MB here - vanished into thin air .