VMware vSphere

 View Only
  • 1.  Understanding Resource Allocation

    Posted Jan 09, 2008 02:18 PM

    I am fairly new to Vmware and need help in understanding the resource allocation part. We use ESX server V3.0.1 and Virtual Centre V2.0.1. When we create a Virtual machine we give it the amount of virtual CPU and how much memory, of course depending on the Physical host or cluster resources. Once we have done that we can change the resource settings of the VM through through resource pools or individually where you can allocate CPU/Memory Shares, Reservations or limits.

    Thats the part I do not understand, once you have allocated VM CPU/Memory when created how does allocating shares, reservation, limits affect its allocation. Such as if you have 2 Virtual Machines with 2GB each but once VM has a high share allocation of memory and the other has low share allocation of memory who does that work when they both have been allocated 2GB memory. Does that mean that both VM are not guranteed 2GB or do the share. reservation and limits come into affect when the resources are limited. Also if the resources are available does that VM could use more memory than the 2GB set.

    Also if you have a 2 VM's, and VM1 has 4GB of memory and VM2 has 2GB memory, but VM1 has a memory share setting of Low and VM2 has a memory share setting of high, how would that work.

    I am just trying to understand the difference allocation CPU/Memory values set when the virtual machine is created and the shares, reservation and limits value set afterwards.



  • 2.  RE: Understanding Resource Allocation

    Posted Jan 14, 2008 02:18 AM

    I'm not an expert, but I can say a little about how this works. Note that I am saying VM, it could be a resource cluster as well, but I stick to VM just to make it simple to write.

    When it comes to memory and CPU resources, you can assign different different shares, depending on which VM that needs most resources. So let's say that you have 2 VM's, with 2 GB RAM each. And you only have 2 GB in total of your host. Both VM's then have to share the RAM, altough ESX is pretty good at keeping the RAM usage for the VM's to a minimum. If you set the shares to be equally among the two VM's, both would compete for the RAM at the host at the same level. If you set one of the VM's to have half of the shares as the other, the VM with the lowest amount of share would loose the the right for RAM every second instance it's need RAM. So, on the other VM you still have not done anything with the VM shares, but because you lowered the shares for the first, the second vm is getting i higer priority. In your example, where one is Low and the other High, the actual setting would be 1 to 4 (ie 1:4), because you lowered the shares on one and raised the other one. This means that the Low would get 25 % of the shares and the other 75 % of the shares.

    You can set shares manually, or just use the predefined settings of Low, Medium and High. For small and simple deployments, this would be enough.

    For CPU it is basically the same as for RAM.

    When it comes to reservation and limits, this is what it's named. You set a limit that a VM (or resource pool) can not use more then the exact amount of physical RAM or CPU. A reservation is a reservation for the physical CPU and RAM to a certain VM or resource pool.



  • 3.  RE: Understanding Resource Allocation

    Posted Jan 14, 2008 02:28 AM

    This post, while trying to be helpful, is a fallacy.

    Shares ONLY apply WHEN the host is LOW on resource.

    Using your same example, the host (with more like 8Gig of RAM) has 4 VM's each with 2G assigned. Assuming the VM's are idle, their usage is based upon need. Even though each VM can have assigned 2G to the guest, the host may only allocate 700Meg to accomplish this, leaving almost 5G free on the host.

    If for some reason 2 of the VM''s start ballooning the memory, and thus increasing the host load.

    As the host becomes taxed for memory, then and ONLY then do the shares for resource allocation apply. The shares do NOT have any affect until the host has no more memory to allocate, and the VM's with the highest shares get the lien share (as allocated by the share level) and the rest of the VM's will have to get what's left over.

    That's how shares work. when the host is in surplus ALL VM's get equal share of CPU and Memory, despite what their share level is.

    I could have 1 VM at 1 share, and 1 at 20000, they will both get EQUAL share until the host can't spare more memory, the VM's with the highest share's get the memory based upon priority, which is the same as shares.

    This applys to CPU and disk shares as well. Shares only apply during times of contention.