Understanding resource controls

An administrator can customize the amount of resources allocated to a virtual machine or to the resource pool in which those virtual machines reside by modifying resource controls. Each of the primary four resources (CPU, memory, network, and storage) can be controlled, but network and storage require the use of the advanced features of Network I/O Control or Storage I/O Control, respectively. There are three resource controls that are available to determine how resources are provided to a virtual machine, these are: shares, limits, and reservations. When an ESXi host's memory or CPU resources are overcommitted, a virtual machine's allocation target is somewhere between its specified reservation and specified limit, depending on the VM's share and the system load. This is something that we will explore later on in this chapter.

Shares

A share is a value that specifies the relative priority or importance of a virtual machine (or resource pool) in regards to its access to a given resource. Keep in mind that shares only operate in times of contention. Meaning that if, for example, a virtual machine has twice the memory share value of another virtual machine it is competing against then that means it is entitled to twice as much memory when those two virtual machines are competing for resources. However, it is important to note that if there is no contention then share values are irrelevant and a virtual machine can consume up to its limit if available.

Share values may be configured as High, Normal, or Low (or customer values may be used) and these values specify a 4:2:1 ratio, respectively, and this is demonstrated in the following screenshot. A Custom value can also be selected to assign a specific number of shares, or proportional weight, to the virtual machine if the default values are not desired. Be careful when using Custom values; don't lose track of the ratio because doing so will potentially result in disproportioned resources.

By default, virtual machines are assigned a Normal share value. To modify this configuration, right-click on the virtual machine and select Edit Settings. Under Virtual Hardware, expand either CPU or Memory and modify the drop-down box next to Shares. The following screenshot provides an example of memory resource controls that are available to be configured:

Shares

These share values can be assigned individually for memory and CPU resources. For example, a virtual machine may be configured for a High share value for CPU but a Normal value for memory resources.

Shares make more sense when it is considered that shares work in comparison to other virtual machines or other resources pools at the same level. This means that shares are used to compete against sibling objects (virtual machines or resource pools) while in contention within the same parent in a resource pool hierarchy.

The following figure demonstrates a three virtual machine scenario where share values are being enforced (during contention). The total share values equal 9000 in total; this means that during contention VM1 receives 3000/9000 or 33% of resources, VM2 receives 1000/9000 and gets 11%, and VM3 receives 5000/9000 or 56% of resources.

Shares

Keep in mind that this is all relative so should another virtual machine power on at this level then the total amount of shares change. Now the share values total to 14000. VM1 would receive 21%, VM2 would receive 7%, and VM3 and VM4 would receive 36% each.

Shares

Do not forget that share values are only enforced during contention!

It is recommended that virtual machines and resource pools should not be made sibling objects within a hierarchy because, by default, resource pools are assigned shares that may not appropriately compare to those assigned to a virtual machine. This can potentially cause performance issues.

Shares can also be configured for datastore and network access. This is discussed later in the chapter.

Limits

A limit specifies the ceiling of CPU cycles or amount of host physical memory that a virtual machine can consume. By default, a virtual machine is set to unlimited for both CPU and memory resources, but this is a bit misleading. A limit is specified in megahertz or megabytes. A virtual machine can only consume up to its configured amount plus overhead; if a virtual machine is configured for 8 GB of memory then it cannot exceed 8 GB plus memory overhead even though the memory limit is set to unlimited. In this scenario, 8 GB plus memory overhead is the virtual machine's inherent and effective limit since that is the configured amount.

Limits can be used to manage user expectation in a small environment and are especially great for use in test environments to continually lower the amount of resources in order to determine how much should be configured in production. The drawback to configuring a limit is that the guest operating system believes that it has the configured amount of the resource but a limit was configured. Let's say a virtual machine is configured for 8 GB of memory and a limit was set at 4 GB. If you look at the system properties of the guest operating system, it will display that 8 GB of memory is available and is unaware that a limit was set and the virtual machine cannot exceed 4 GB of physical host memory. When a limit is reached, the guest operating system can still request new pages of memory, but because of the configured limit, the VMkernel will not allow the guest operating system to consume more physical memory. The virtual machine will be treated as though it were under contention. Memory reclamation techniques will be used to allow the virtual machine to consume more memory resources as requested. First, the VMkernel will inflate the memory balloon driver to let the guest operating system memory manager decide which to page out, then compression will occur, and in a worst-case scenario, swapping can occur. If swapping is possible in your environment, consider placing the .vswp files on Tier 1 storage for better performance when in contention.

If a CPU limit is set on a virtual machine, then the virtual machine is deliberately restrained from being scheduled on a physical processor once the allocated CPU resources are consumed. For a symmetric multiprocessing virtual machine, this means that the sum of all vCPUs cannot exceed the specified limit. For example, a virtual machine with 4 vCPUs and a limit of 1600 MHz with an equal vCPU load cannot exceed more than 400 MHz per vCPU. If only one vCPU is under stress then the load will be distributed across the rest of the vCPUs.

This can cause certain applications to have undesirable behavior and performance degradation. Use limits sparingly.

To set a resource limit for a virtual machine, right-click on the virtual machine in the vSphere Web Client and select Edit Settings. Under Virtual Hardware, expand the desired resource and modify the Limit as needed. An example of this is demonstrated in the following screenshot:

Limits

A CPU limit can be configured using the same process outlined above except that the CPU will be expanded. Once set, click on OK.

Reservations

A reservation specifies the guaranteed minimum resource allocation for a virtual machine. If a virtual machine has a reservation, then the full reservation must be satisfied in order for the virtual machine to power on. A virtual machine will not power on if a reservation is not met. A reservation is specified in megahertz or megabytes. The reservation is guaranteed, even when the server is heavily loaded, meaning that the VMkernel does not reclaim physical memory if it is reserved, even if there is contention. This reserved physical memory will be available to that specific virtual machine at all times, regardless of contention. If a memory reservation is configured for a virtual machine, this is always guaranteed, even when in contention as memory reclamation techniques cannot take away that portion of memory. Since this memory cannot be taken away from a virtual machine during contention then this means that it will not be swapped; a memory reservation changes the size of the .vswp file. Without a reservation, the virtual machine's swap file will be the size of configured memory; however, if a reservation is configured then the swap file will be the size of the configured memory minus any memory reservation. This means if a virtual machine is configured for 4 GB of memory then the .vswp will be 4 GB unless there is a reservation. If a reservation of 1 GB is configured then the .vswp file would be sized at 3 GB.

Reservations should be used for business-critical virtual machines in order to guarantee a specific minimum amount of CPU and/or memory resources.

To set a resource limit for a virtual machine follow these steps:

  1. Right-click the virtual machine in the vSphere Web Client and select Edit Settings.
  2. Under Virtual Hardware, expand the desired resource and modify the Reservation as needed.

    Reservations

A memory reservation can be configured using the same process outlined above except that Memory will be expanded. Once set, click on OK.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.218.137.93