VMware Cloud Community
alex777
Contributor
Contributor

memory swap

Hi.

Prompt me please in what difference of memory balloon from memory swap ?

Where does ESX place swap file when virtual machines require more than it is been memory physical ? How to look does ESX use virtual memory (swap) ?

Reply
0 Kudos
11 Replies
jrenton
Hot Shot
Hot Shot

Read this document by VMWare. It should explain everything:

John

AWo
Immortal
Immortal

When a guest requests memory which can't be satisfied with physical memory, ESX has the possibility to start using memory in a different guest (blowing up the ballon there). This forces this machine to start swapping to disk, because the balloon process requests memory (this is guest OS level swapping!!!). This memory allocated by the balloon driver can then be taken out of this guest and granted to another one.

In short terms: the balloon driver frees up memory in one guest to give this memory to another guest. It does this by forcing the guest to swap out.

If you have done memory overcommitment, that means you assigned more memory to all guests in sum than what is physically available in the ESX host and if the memory consumption of all guests get's higher than the physical memory available, the ESX host can start to swap out itself. Thereby it emulates physical RAM to the guests. This should never happen when you assign less memory to all guests than physically available. Consider this mechanism as something to keep the guests running in case the host runs out of physical memory. This will cost a lot of performance. So this is a situation you don't want to have in a production environment.

vExpert 2009/10/11 [:o]===[o:] [: ]o=o[ :] = Save forests! rent firewood! =
weinstein5
Immortal
Immortal

There are three things the vmkernel does to free up memory - done in the following order - Transparent Page Sharing, Balloon Driver and the per vm vmkernel swap file -

  1. Transparent Page Sharing - This is the vmkernel's ability to identify identical memory pages being stored by different vms and instead of storing multiple copies will store a single instance in read only memory. This page will stay there as long as the vm does not write to the page. once the vm writes to the page a copy and the write is performed. If the new page matches another page the process will repeat again - This is done with out the vms operating realize it is going on - this saves a ton of memory

  2. Balloon Driver (vmmemctl)- This is installed with VMware tools into the vm. It allows the vmkernel to force the guest operating to use its own virtual memory if memory is running out for the vmkernel.

  3. per vm vmkernel swap file - if the vm still requires memory and the Transparent Page Sharing and the Balloon have not freed up enough memory the vmkernel will utilize the per vm swap file - swapping vm memory out of physical RAM to disk - this is memory of last resort it will greatly affect the vms performance - its size is equal to the memory assigned to the vm minus any reservation and is created when the vm is first started and by default in the directory the VM's configuration file is stored . This allows the vmkernel to have enough disk space to swap the vm's entire memory to disk.

If you find this or any other answer useful please consider awarding points by marking the answer correct or helpful
Reply
0 Kudos
alex777
Contributor
Contributor

Memory balloon used only when total memory required by VMs more that physical EXS host accessible ?

In this case is swap file created in guest OS ?

Where this swap file located ?

If vmtools is not installed (balloon driver is not accessible) and this VM requires memory more than accessible physical, then ESX will use vmname.vswp as a swap file ?

Reply
0 Kudos
AWo
Immortal
Immortal

When the guest starts to swap beacuse of the balloon driver, the swap file is wherever the guest OS holds it (Default for Windows is C:\).

When ESX starts to swap for a guest it can be configured with the VC client. Default is in the guest directory.

vExpert 2009/10/11 [:o]===[o:] [: ]o=o[ :] = Save forests! rent firewood! =
Reply
0 Kudos
weinstein5
Immortal
Immortal

Memory balloon used only when total memory required by VMs more that physical EXS host accessible

Sort of - the Balloon Driver is activated when the vmkerenl is running out of memory - which by the very nature means you have over committed memory - but remember Transparent Page Sharing is used first and so you can have a situation where you have overcommitted memory (the sum of the memory assigned to vms is greater than the physical memory in the ESX Host) but because of TPS there is no need for the balloon driver

Where this swap file located ?

As the others have indicated by defaukt it is in the same directory where the boot disk of the virtual machines is stored but ESX 3.5/VC 2.5 you know can select a different datastore to hold you vm vmkernel swap file - It is NOT created in the guest O/S

If vmtools is not installed (balloon driver is not accessible) and this VM requires memory more than accessible physical, then ESX will use vmname.vswp as a swap file ?

Yes it will automatically start using the vmkernel swap file (vmname.vswp) to store the vm's memory that will not fit in the esx host physical RAM

If you find this or any other answer useful please consider awarding points by marking the answer correct or helpful
Reply
0 Kudos
alex777
Contributor
Contributor

Other things being equal in both cases (Balloon Driver or per vm vmkernel swap file) will there be the identical loading on the system ? Productivity of ESX host fall down identically ?

Reply
0 Kudos
weinstein5
Immortal
Immortal

No effect will not be identical - the per vm vmkernel swap is memory of last resort - if you are using the vmkernel swap this negatively impact the performance of your VM while the balloon will only exercise the guest operating systems own virtual memory so yes there will be an impact on performance but not at the level that is caused by the vmkernel swap file - now I am not saying you should ignore that the balloon driver is deployed because if the vmkernel is deploying the balloon driver because this is an indication that your ESX hosts is running short on memory and will need to be addressed either by increasing the host memory or adding additional ESX hosts to move the VMs to -

If you find this or any other answer useful please consider awarding points by marking the answer correct or helpful
Reply
0 Kudos
alex777
Contributor
Contributor

I do not understand why will an effect of influence on the productivity be different ? As at "per vm vmkernel swap", so as at "balloon driver" required by VM memory will be read with same datastore in an identical size. At other equal the same size of the required memory will be read from a physical disk in both cases, only location of swap file in datastore will be different.

If I right understand a process, then influence on the productivity of read / write from the swap file in both cases must be exemplary identical.

Reply
0 Kudos
weinstein5
Immortal
Immortal

Yes both do swap out to the same disk but the issue is what is driving the memory swap - in the case of the balloon driver it will cause the guest operating system of the virtual machine to use its own virtual memory - this is all done within the virtual environment and will cause a similar performance impact similar to a physical machine that is utilizing its own virtual memory - in the case of the vmkernel swap it is the vmkernel that will be using the vmkernel swap memory which affects the vmkernel's performance of providing a virtual environment causing a greater performance impact than just the guest o/s using its own virtual memory -

If you find this or any other answer useful please consider awarding points by marking the answer correct or helpful
Reply
0 Kudos
alex777
Contributor
Contributor

Does a most contribution to influence on the productivity of ESX host make not swap process, but mechanism of its realization ? Balloon driver influence on the productivity of the VM, while mechanism of vmkernel swap on the productivity of all VMs on the ESX host ?

Reply
0 Kudos