VMware Cloud Community
jacquesdp
Contributor
Contributor

Swap file and memory usage

Hi Guys, I have a question about how swap files and how memory are used. I am aware that swap files are used in order to overprivision the memory, by reserving RAM you can prevent swap file usage. My question is, how does VMWare decide what must reside in memory and what in swap when RAM is not reserved?

The reason why I ask is we have a fair mixture of very busy and idle machines. Is the theory that we should rather swap on the idle machines and reserve on the busy machines?

Thanks!

Jacques

Reply
0 Kudos
1 Reply
RParker
Immortal
Immortal

My question is, how does VMWare decide what must reside in memory and what in swap when RAM is not reserved?

This is done at the guest level not ESX level, your guest OS decides what swaps. The only thing you are doing with reserved RAM is that the guest OS doesn't have to use a swap file to get the RAM its allocated, so when it's reserved it's ALWAYS available.

Is the theory that we should rather swap on the idle machines and reserve on the busy machines?

No that's not quite it, busy machines vs idle is irrelevant. What you want is active and granted memory usage, which performance monitoring will tell you. If you have an active VM with 4GB and swap, and an idle machine with 1GB and reserved, there is no guarantee that 4GB VM won't need more RAM, or 1GB is enough. The problem with reservation is you can't share it or allocate it with other VM's so your consolidation and ESX host will become limited. The best thing to do is monitor RAM usage how much is the guest OS actually using, not how much it's allocated.

The Guest OS (i.e. Windows 2008) may take all the RAM it sees, so that's not really 'using' the RAM, part of it is cache. Therefore you have to look inside the guest, see how much is RAM how much is cache, and how much is allocated, how much is granted to the VM and how much the VM has in ACTIVE use, those are the key indicators that will tell you RAM to setup for VM's.

Pools do a wonderful job with this, so you can put high priority on your busy machines and low on idle and put them in pools big enough to give enough RAM to use, and don't reserve ANY of them to start. Then monitor them, I think you will find that ESX 4.0 does a marvelous job of managing this for you.

Reply
0 Kudos