Information Technology Reference
In-Depth Information
Some would say that you should just increase the reservation for that VM. Although that
might be a valid technique, it might limit the total number of VMs that a host can run, as indi-
cated previously in this chapter. Increasing the coni gured amount of RAM also requires a
reboot of the VM to become effective (unless you are running a guest OS that supports hot-add
of memory and that feature has been enabled for the VM, as described in Chapter 9), but shares
can be dynamically adjusted while the VM remains powered on.
One key part we must repeat is that shares come into play only when the ESXi host cannot
satisfy the requests for memory. If the ESXi host has enough free memory to satisfy the requests
from the VMs for memory, then it doesn't need to prioritize those requests. It has enough to go
around. It's only when the ESXi host doesn't have enough to go around that decisions have to be
made on how that resource should be allocated.
For the sake of this discussion, let's assume you have two VMs (VM1 and VM2), each with
a 1,024 MB reservation and a coni gured maximum of 4,096 MB, and both are running on an
ESXi host with less than 2 GB of RAM available to the VMs. If the two VMs in question have
an equal number of shares (let's assume it's 1,000 each; we'll show you actual values shortly),
then as each VM requests memory above its reservation value, each VM will receive an equal
quantity of RAM from the ESXi host. Furthermore, because the host cannot supply all of the
RAM to both VMs, each VM will swap equally to disk (VMkernel swapi le). This is assuming,
of course, that ESXi cannot reclaim memory from other running VMs using the balloon driver
or other memory-management technologies described previously. If you change VM1's Shares
setting to 2,000, then VM1 now has twice the shares VM2 has assigned to it. This also means
that when VM1 and VM2 are requesting the RAM above their respective Reservation values,
VM1 gets two RAM pages for every one RAM page that VM2 gets. If VM1 has more shares, VM1
has a higher-priority access to available memory in the host. Because VM1 has 2,000 out of 3,000
shares allocated, it will get 67 percent; VM2 has 1,000 out of 3,000 shares allocated and therefore
gets only 33 percent. This creates the two-to-one behavior described previously. Each VM is
allocated RAM pages based on the proportion of the total number of shares allocated across all
VMs. Figure 11.6 illustrates this behavior.
Figure 11.6
Shares establish rel-
ative priority based
on the number of
shares assigned out
of the total shares
allocated.
4,000 shares allocated
VM with 1,500 shares
gets 37.5%
3,000 shares allocated
2,000 shares allocated
VM with 2,000 shares
gets 67%
VM with 1,500 shares
gets 37.5%
VM with 1,000 shares
gets 50%
VM with 1,000 shares
gets 50%
VM with 1,000 shares
gets 33%
VM with 1,000 shares
gets 25%
Search WWH ::




Custom Search