Most organizations use a simple categorization approach to make sure that virtual machine performance stays at...
an optimal level so that those virtual machines get enough resources to fit the business requirements.
If you're a virtualization administrator, you may often assume the peak workloads of virtual machines (VMs) spread over the course of the day. But what happens when the VMs want more resources than the ESXi host can give? This is resource contention, which leads to reduced VM performance. The following options detail how to guarantee that each VM gets the resources it needs during contention.
Set the right reservation
One of the great resource features in VMware vSphere is the reservation, which makes resources available on request. Setting the right reservation will ensure a virtual machine performs to its service level during resource contention.
There is a consequence to reservation, though: A particular piece of resource can only be guaranteed to one server instance, so total reservations cannot exceed total available resources. This is called admission control and is invoked when you power on a VM. If you don't have enough unreserved resources for the reservation on the VM, then you cannot power the VM on. In most environments, you wouldn't reserve 100% of the resources configured on every VM, since that would prevent memory overcommit, which is the ability to run VMs that together are configured with more resources than are present in the physical ESXi host.
Start contention to test the limits
If your VM has a well-defined, measurable service level, then it is possible to find the minimum amount of resource that is required to deliver the service level. The best method is to cause contention on the VM artificially, increasing the contention until the VM only just meets the required service level.
Causing contention on a single VM is simpler than you might think. There is a resource control called a limit that restricts the amount of resource the VM gets, even if the ESXi server is not overloaded. When a VM is limited, the ESXi server takes resource away just as if there was a shortage. You can find out the minimum resource needed to deliver the service level by slowly reducing the resource limits while measuring the application response. When the application response just meets the service level, then the limit you have is the amount of reservation the VM needs to guarantee the same service level.
You need to do this for both CPU and RAM and for each VM, and remember to remove the limits once you've set the reservations. If this sounds like a lot of work, you're right. If you have more than a dozen VMs, then this is a nightmare. Few virtualization administrators have the time or the inclination to go through this process.
Solve the problem with a big price tag
One simple approach to optimizing VM performance is to deny overcommit, severely limiting the number of VMs you run on each host. This gets expensive fast. You end up needing around twice as many physical servers as you'd probably need if you allowed overcommit. But if you don't overcommit, then there should never be contention, so no VM will ever be denied resources. I call this "the Microsoft method" as Hyper-V doesn't allow memory overcommit, although it does have some great resource management with dynamic memory.
Prioritize your virtual machines
A more common approach to maximizing performance is to classify your VMs into three grades: critical, important and normal. The grade for each VM should be tied to how important the VM's performance is. Fitting VMs into the three categories is about fitting the business value of the VM to the cost of dedicating resources to it.
1. The first tier: Critical virtual machines
Critical VMs get a 100% reservation; they will never experience contention because they are guaranteed their configured resources. Aptly named, these VMs are critical to your business remaining operational. Critical VMs must always perform at their best, but choose carefully since you aren't allowing overcommit for these VMs.
2. The second tier: Important virtual machines
Important VMs get a reservation of 50%. Their performance will degrade during contention, but not too badly. While these VMs are important, they can run a little slower for some time and the business will still make money.
3. The bottom tier: Normal virtual machines
Normal VMs get no reservation. They are guaranteed nothing; during resource contention their performance will suffer the most. Normal priority VMs can run slowly, and the business will still make money.
Put more hardware to work
A reservation is a guarantee from the hypervisor to deliver resources and deliver a certain application performance. It is possible to avoid resource contention by buying excessive physical resources, and you can carefully work out the minimum required resource.