A: In a recent FAQ, I reported on VMware's five best practices for memory management (as outlined in its recent document "Understanding Memory Resource Management in VMware ESX 4.1"). The fifth of those recommendations suggested that when assigning memory resources to VMs, you should "Set an appropriate memory size."

What, exactly, is that correct size? Considering all the memory management techniques at vSphere's disposal, you might find that you're getting the answer quite wrong.

Even though vSphere can handle oversubscription of memory, doing so without purpose is never a good idea. VMware's guidance suggests that, "virtual machine memory size should be slightly larger than average guest memory usage." This means that even though you can significantly oversubscribe memory (such as giving 4GB of RAM to a VM that only uses a half-gigabyte) you really shouldn't.

When VM memory is set to too high, more overhead memory must be reserved for that VM. Setting memory too high can automatically invoke the memory management techniques described in my last FAQ and in VMware's document. These activities require resources to accomplish, which could have an impact on VM performance.

For best results, use vSphere's memory counters to help you understand the actual values of each VM's memory needs. Then, adjust assigned memory so that each VM gets just enough for its needs.