Reservations and limits are configuration items that refer to memory and CPU. Let’s give a quick definition of the term and then a demo of how that item impacts memory allocation. CPU reservations and limits can be understood rather easily once we nail down the memory side of things.
Reservation – The amount of CPU or memory that is guaranteed to that VM. That is, if the host doesn’t have those resources free, the VM can’t even power on.
The reservation setting has a number of impacts on the memory for a particular VM. The first item it impacts is the VM swap memory. If you recall from my last post, the VM creates a VM swap file for itself that is equal in size to that of it’s allocated memory. This changes once you configure a memory reservation. Let’s take a look…
So on this host, I’ve allocated 8 GB of RAM. I’m also going to configure a 2 GB memory reservation…
Now, lets save these settings, and power up the VM. Now let’s check the data store and see what it created for a VM swap file…
As you can see, the VM swap file is no longer the size of the allocated memory. Rather, it’s the allocated memory -(minus) the memory reservation. When you think about it, this makes perfect sense. I’m guaranteeing to the VM that it will have 2 GB of physical host RAM. That being said, it really only needs 6 GB of disk swap space.
Despite having a memory reservation, the host memory isn’t automatically allocated to the VM when it powers on. That is, the hypervisor still allocates RAM on an as needed basis. However, it will always make sure that the memory to fill the reservation is available to the VM and not allocate it to other tasks.
There are a couple of other memory definitions in vSphere that I’d like to define before we wrap up the memory reservation piece.
Memory Overhead – The amount of memory that the hypervisor believes is required just to keep the VM running. This memory gets allocated to VMkernel itself or other processes that are running to service VMs.
Consumed Host Memory – This is the total amount of physical memory that has been allocated to this host. This number can be larger than the total allocated VM memory since this number includes the Memory overhead total.
Active Guest Memory – This is the amount of memory that the hypervisor believes the VM is actually using. This isn’t an exact number since it’s based off of statistical gathering and sampling.
These numbers can all be found by looking at the summary tab of a particular VM…
Now, here’s is where it get’s confusing. Click on the Resource Allocation tab next to the Summary tab….
So let’s define some of these memory terms….
Consumed – Same as the Consumed Host memory definition. This should equal ~ the private memory allocation plus the actual overhead consumption.
Overhead Consumption – The amount of memory ACTUALLY be used as VM overhead. Notice that this is different than the number we saw on the summary page which is really just an estimation.
Private – The amount of memory that’s being allocated from physical memory on the host to the VM.
Shared – The amount of memory that’s being shared with other VMs through TPS (transparent page sharing).
Active – Same as the Active Guest memory Definition
Unaccessed – Sort of a mystery to me but it’s supposedly the amount of memory which has not yet been addressed by the host.
Swapped, Compressed, and ballooned should all hopefully read as 0. If they didn’t, that would indicate those features were in use.
Ok, so I just wanted to get those defined. Let’s look at Limits now…
Limits – The Limit is to define how much actual physical RAM a VM can use. The default setting for this is unlimited (meaning as much as you allocate to a VM).
So why would we ever want to limit the amount of physical host memory that a VM can use? When we oversubscribe memory. So let’s look at how we might configure this. Let’s say we have a host that we’ve assigned 8 gig of memory to. Now, we want the guest to think it has that much, but in reality, we cant actually let it have 8 gigs of RAM from the host ESXi box. So we tell it that we for sure want it to have 4 gigs of host RAM (Set a reservation for 4 GB) but also tell it that we don’t want it to ever use more then 6 gigs of host RAM (set a limit for 6 GB). In doing this, we tell the machine the following…
-You get a dedicated 4 GB of host RAM if you need it
-You can have up to 6 GB of host RAM if it’s available
-Anything over 6 GB of host RAM requested will get swapped out
So this makes pretty good sense. The same reservations and limits can apply to CPU. But since I think I already beat the proverbial horse here, I’m going to call an end to this blog.