By default, a VMware host distributes an equal amount of CPU, RAM and I/O resources to every virtual machine. But not all ESXi workloads are created equal.
Because a typical VMware host houses multiple virtual machines (VMs) with different workloads, it's important to manually adjust the resources allocated to each VM. This practice ensures that each workload receives enough resources and that the resources are efficiently distributed. It also maximizes the amount of VMs that you can place on ESXi hosts.
Measuring VMware host workloads
Before adjusting your VMware host resources, you should analyze your VM workloads. For an overview of the current resource allocation in ESXi, select the Resource Allocation tab in the vSphere Client. If no resources settings were configured, the VMware host resources are divided equally.
In this overview, you'll see the total capacity and current usage of memory and CPU. If the current usage figures approach the ESXi host's maximum capacity, you can make adjustments to improve the host's efficiency.
After finding out the host's current resource-usage numbers, check the Resource Allocation tab for each VM. You'll find an option to change CPU and memory settings. To change these parameters, click Edit, which opens the Virtual Machine Properties window. Next, click the Resource tab to access the resource usage settings.
CPU allocation on a VMware host
For CPU resource allocation, there are three items that you can change:
- CPU shares: By default, every VM gets 1,000 shares. To increase or decrease the VM's priority, you can increase or decrease its shares. If you want to ensure that your busy database server uses twice the amount of CPU cycles as the not-so-busy Web server, for example, set the database server's shares to 2,000 and set the Web server's to 500.
- Minimum amount of CPU resources: You can set aside a certain amount of CPU resources that will always be available to a VM.
- Maximum amount of CPU resources. Although VMs don't have a limit to the amount of CPU cycles they can use by default, in many cases it makes sense to set a reasonable maximum, which the VM will normally never go beyond.
Memory allocation on a VMware host
For memory resources, the story is a bit different. Each VM receives a default memory allocation, but you can change the amount of RAM assigned to each VM based on its workload. Even after you allocate a certain amount of RAM to a VM, the host will still dynamically assign memory to the VMs as needed, up to the level specified.
If you want to ensure that a VM always gets a certain amount of RAM, you can also specify a minimum allocation. Even if the VM isn't running, the host will not distribute this memory to another VM. Stated otherwise, by increasing the amount of RAM reserved for VMs, you decrease the host's flexibility to use memory overcommit, which, in turn, limits the amount of VMs a host can run.
There is also a setting for the VM's maximum memory, which isn't really useful. It is a fixed amount of memory that cannot be dynamically adjusted, which also limits your flexibility.
Managing I/O resources on a VMware host
You can also limit the amount of I/O operations per second (IOPS) that a VM has access to. By default, VMs don't have a limit on the IOPS they can send and receive, but it may make sense to set a database server's available IOPS higher than an infrequently used Web server's IOPS. To do this, adjust the share values for each VM.