Running VMs under ESXi will incur a memory overhead for each virtual machine. You can read about this overhead here: Understanding Memory Overhead. Essentially memory overhead is:
Overhead memory includes space reserved for the virtual machine frame buffer and various virtualization data structures, such as shadow page tables. Overhead memory depends on the number of virtual CPUs and the configured memory for the guest operating system.
While ESXi provides memory optimisations such as page sharing which have the potential to save more memory than is taken up by the overhead, it’s still worth including the RAM overhead in any calculations used to determine the number of VMs per host (especially for VDI or RDS/XenApp).
If I’m going through a sizing exercise, I’m not typically going to account for RAM optimisations as I don’t know how much RAM will be saved until the solution is deployed.
VMware has a reasonably complete table for VM RAM overhead for ESXi 4.0, plus a sample table for ESXi 5.1. From what I can tell, a complete table for ESXi 5.x doesn’t exist, so unfortunately you’ll need to create your own. That’s a straight-forward task, but will be time consuming.
I’ve created an Excel spreadsheet that I can use for estimating the number of virtual desktops or XenApp servers per host based on some specific configurations and that includes calculating the VM RAM overhead.
Here’s what it looks like in Excel:
The INDEX formula is used to return the amount of RAM overhead based on the vCPU and RAM values that we input into the spreadsheet. In this instance, I have two inputs - number of vCPUs (B3) and amount of RAM in GB (B4) assigned to my sample VM (for RDS/XenApp or VDI, I’ve assumed that all VMs on the host are configured identically.
Here, array is the amount of RAM Overhead to select from - essentially the lookup table I’ve added into the spreadsheet that lists the amount of VM RAM Overhead (D6 to I16), row_num is the number of vCPUs assigned to the VM (1 to 8), column_num is the amount of RAM assigned to the VM (256Mb to 256GB).
To select from the appropriate row and column in the table, I need to match the inputs from the array of vCPUs (E5 to L5, or 1 to 8 vCPUs) and the amount of RAM (from D6 to D16, or 256Mb to 256GB of RAM). The MATCH formula will look like the below. Lookup_value will be the number of vCPUs or amount of RAM, lookup_array is the number of vCPUs in the table to select from (1 to 8). We can ignore match_type.
MATCH(lookup_value, lookup_array, [match_type])
So, now my formula will look something like this:
INDEX(array,(MATCH(lookup_value, lookup_array)),(MATCH(lookup_value, lookup_array)))
To make this work in Excel, I’ve also added two extra components to the formula, converting GB to MB by multiplying the VM RAM size input (B5) by 1024 and rounding the result to a single decimal place. The resulting formula is then:
=ROUND((INDEX(<Lookup table>,MATCH((<VM RAM size in GB>*1024),<VM RAM size column>),MATCH(<No. VM vCPUs,<vCPUs Row>))),1)
I can then multiply the result by the number of VMs to get a full picture of the amount of RAM consumed on the host.
Here’s a downloadable version of the Excel spreadsheet, which includes the ESXi 4.x version of the VM RAM Overhead.
With a bit of effort, you could update the table for ESXi 5.x.