This discussion goes back to the early days of virtualization and how resources are assigned. Before, people wanted to assign virtual hardware the same way they did physical hardware, which leads to inefficient use of resources. This has become less of an issue in today’s virtual data centers, but there are still some ratios that people need to be aware of. I am going to cover some of the important things to consider around the assignment and oversubscription of CPUs and help you increase the CPU performance in your VMware environment.
Improving CPU Performance in Virtual Machines: It’s All About CPUs
As a VMware admin you will need to learn about your application environment and servers when virtualizing them. This means that if they are moving from physical to virtual you should monitor their resource usage before moving to virtual. This can be done with OS level tools or there are a number of third-party tools available to help with this.
The main theme here is to accurately identify what the application’s needs will be so that you can assign an appropriate amount of resources to the virtual server. Sometimes you will be working with app owners who are bringing in a new application, and some of these vendors request some pretty large virtual resources. This may be a result of them still thinking in terms of physical servers. You will need to negotiate to a sizing level that both parties are comfortable with.
In short, it’s better for you to start at a smaller more reasonable level and work to tune the application for best performance. It will be easier for you to scale up the resources as demand can be identified versus trying to steal resources back from the application. Most newer Operating Systems can hot add resources but cannot be removed without an outage.
The last thing you want to do is keep piling on resources to the point in which things get out of control. As you can see from the image below, nothing good will come from this method.
So you may be wondering what would happen if you handed out too many vCPUs in your environment. Well, a few things: First, there would be a negative affect on VM performance and second, there would be a reduction in the amount of VMs you might be able to fit on each host. The thing that I want to point out is if you assign too many unnecessary resources, eventually they are going to overwhelm and affect performance. This might not even be a result of high demand, but rather a side effect of poor allocation. Much like the people in the bus below found out they were soon over taken by the horde.
Managing vCPU Performance
When it comes to manage vCPU performance in a VMware environment there are two primary items that you want to be monitoring and managing.
- vCPU to pCPU ration: This is the ratio of virtual CPUs to physical CPUs. Lets say I have a host with two sockets and each have four cores. This gives me eight physical CPUs in my host server. To keep my math simple, we will load on eight VMs and each will have two CPUs. This gives me a vCPU ratio of 2:1. Depending on your application workload and performance needs you can easily scale to a higher ration. But some workloads – like SQL, for example – usually require a vCPU ration in the range of 1:1 to 2:1 in order to deliver the performance required.
- CPU ready time: This is the amount of time a VM waits in a ready to run state while it waits to be scheduled on a physical CPU. It is not uncommon to see a small amount of CPU ready time on VMs, but when the value raises above 10% per vCPU, you will begin to see performance issues. This is something that should be monitored on a regular basis. You should look into it right away if there is a complaint of performance issues.
I have really only scratched the surface here on this subject. In a future post I’ll go further into in how to identify CPU ready issues.
(The images used in this article were used from the movie World War Z, which is an awesome movie that I recommend.)