VMware Cloud Community
Arkady
Contributor
Contributor
Jump to solution

Memory management on VM

I am looking for clarification about memory management on virtual machine.

For example I have a machine with 4 Gb memory assigned: no limits, no pre-allocation. Plenty of available memory on the ESX host

I thought if machine needs more memory, it will grab it from available memory on ESX host.If ESX host does not have enough memory, balloon driver will borrow memory from other VMs.

And the last resort is to use swap file.

Is it correct?

Thank you in advance.

0 Kudos
1 Solution

Accepted Solutions
weinstein5
Immortal
Immortal
Jump to solution

Not really - the vmkernel follows these steps to free up memory:

  1. Transparent Page Sharing - This os the vmkernels abaility to recognize identical pages being stored by the runningvirtual machines and storing these pages one time in read only memory - when the vm goes towrite to that page the vmkernel will make a copy of the page and the vm will write to that copy - this save quite a bit of memory on your ESX server -

  2. Balloon Driver - this is installed in to the virtual machine with vmware tools - it allows the vmkernel to influence how the guest o/s utilizes its own virtual memory - when the vmkernel determines it is running out of memory it will activate the balloon dirver in the vm forsing the guest o/s to move contents out of its virtual memory which in turn frees up RAM for the vmkernel - so the balloon driver does not 'borrow' memory from other vms.

  3. pervm vmkernel swap file - this is used if the first two do not free up enough memory. It is memory of last resort and will cause vm perfomance problems. vmkernel swap file is created for each vm when it is powered on and is stored in the same directory as the boot vmdk. Its size is equal to the delta of the assigned memory minus any reservations.

If you find this or any other answer useful please consider awarding points by marking the answer correct or helpful

If you find this or any other answer useful please consider awarding points by marking the answer correct or helpful

View solution in original post

0 Kudos
7 Replies
weinstein5
Immortal
Immortal
Jump to solution

Not really - the vmkernel follows these steps to free up memory:

  1. Transparent Page Sharing - This os the vmkernels abaility to recognize identical pages being stored by the runningvirtual machines and storing these pages one time in read only memory - when the vm goes towrite to that page the vmkernel will make a copy of the page and the vm will write to that copy - this save quite a bit of memory on your ESX server -

  2. Balloon Driver - this is installed in to the virtual machine with vmware tools - it allows the vmkernel to influence how the guest o/s utilizes its own virtual memory - when the vmkernel determines it is running out of memory it will activate the balloon dirver in the vm forsing the guest o/s to move contents out of its virtual memory which in turn frees up RAM for the vmkernel - so the balloon driver does not 'borrow' memory from other vms.

  3. pervm vmkernel swap file - this is used if the first two do not free up enough memory. It is memory of last resort and will cause vm perfomance problems. vmkernel swap file is created for each vm when it is powered on and is stored in the same directory as the boot vmdk. Its size is equal to the delta of the assigned memory minus any reservations.

If you find this or any other answer useful please consider awarding points by marking the answer correct or helpful

If you find this or any other answer useful please consider awarding points by marking the answer correct or helpful
0 Kudos
Arkady
Contributor
Contributor
Jump to solution

Thank you.

Please clarify one moment. If 4 Gb VM needs more memory, will it get it?

0 Kudos
weinstein5
Immortal
Immortal
Jump to solution

Only up to 4 GB -

Sent from my iPhone

On Apr 8, 2009, at 1:40 PM, "Arkady" <communities-emailer@vmware.com

If you find this or any other answer useful please consider awarding points by marking the answer correct or helpful
0 Kudos
kjb007
Immortal
Immortal
Jump to solution

The amount you allocate is the upper limit of the memory that the vm can ever have. The ESX server will allocate only that much memory to it. If you overallocate memory on your ESX host, meaning allocate more memory to the vm's than the ESX server physicall has, then the ESX server has to balance memory from vm's that need the memory, and vm's that don't. That is where ballooning comes in. The most memory ESX will give a vm is what you allocate, but if you're not using it, and another vm needs it, ballooning kicks in. If all vm's need the memory, then swap comes in to play as well.

-KjB

VMware vExpert

vExpert/VCP/VCAP vmwise.com / @vmwise -KjB
0 Kudos
Arkady
Contributor
Contributor
Jump to solution

In this case what is the purpose of Limit option for VM?

0 Kudos
kjb007
Immortal
Immortal
Jump to solution

If you've sized the vm appropriately, then a limit is not the most useful option in a vm, since you can allocate less memory. The allocation mark will effectively be the limit for that vm.

-KjB

VMware vExpert

vExpert/VCP/VCAP vmwise.com / @vmwise -KjB
Ken_Cline
Champion
Champion
Jump to solution

In this case what is the purpose of Limit option for VM?

In most cases, simply to cause confusion! The "Unlimited" setting for a RAM limit makes appear that your VM can have access to as much memory as it wants - that is not the case. When you set the Limit to Unlimited, what you are, in effect, saying is that the VM can access up to the Allocation. You have the option of setting the Limit to a value less than the Allocation, which is why the slider is there.

This is one of those cases where I think the UI designers really made a mistake. The Limit slider should cap off at the amount of memory Allocated to the VM rather than at "Unlimited". I understand why they chose to make it unlimited ... so that if you change the Allocation, you don't have to worry about changing the Limit, but there has to be a better way!

Ken Cline

VMware vExpert 2009

VMware Communities User Moderator

Blogging at: http://KensVirtualReality.wordpress.com/

Ken Cline VMware vExpert 2009 VMware Communities User Moderator Blogging at: http://KensVirtualReality.wordpress.com/