Can I safely reduce the number of processors on a VM?
I have a number of Virtual Machines that were created from physical servers. Some of these have (in my opinion) an inappropriate number of processors - for example, we have a web application, accessed internally only, running on a VM with 4 processors allocated. This is the highest specced of our VMs, but there are others I suspect are overspecced.
As I understand it, this can result in performance degradation, as the hypervisor waits until 4 processors are free on the host machine when allocating processor time to this VM. It also causes problems when trying to migrate the VM between hosts. Are these fair assumptions?
Looking at the server itself, I don't see any reason why it needs 4 processors. It just happens that the physical server it had been installed on had that number of processors.
So the question is - what risks are there in reducing the number of processors on this VM?
Some details:
We are running VMware ESX 3.5 on servers with 8 cores and 20Gb. The VM in the example above has 4 processors allocated and 3Gb RAM. The server OS on the VM is Windows Server 2003 Standard SP2 (not R2).
The only serious complication may come from going from multicore (ie 2 or more) to single core. Windows 2000, XP, and 2003 (im not sure about vista, 2008 or 7) used a different kernel for multicore than they did for single core. That said, its probably just going to be some kind of performance penalty, rather than things blowing all the way up.
I would check to make sure that any critical applications didnt get processor affinity set as well - that could ruin your day. see here: http://forums.whirlpool.net.au/archive/735180 or https://web.archive.org/web/1/http://articles.techrepublic%2ecom%2ecom/5100-10878_11-6168870.html
Edit: the same will be true of linux, however the SMP core issue is simply one of performance rather than full-stop issues. linux, on the other hand, is much easier to set processor affinity permanently. see http://www.cyberciti.biz/tips/setting-processor-affinity-certain-task-or-process.html
Yes, your assumptions are correct: the ESX scheduler needs to have 4 available cores in order to schedule execution of a VM with 4 vCPUs, so it will just not run at all if only 2 or 3 of them are available, regardless of how the VM is actually going to use them; the guest O.S. may have only one thread running, but the ESX scheduler will still not be able to make the VM run if there are not enough available free cores.
Reducing the number of vCPUs is generally a safe operation, but this strongly depends of the guest O.S., which will actually need to cope with the (virtual) hardware change. Recent Windows and Linux systems usually don't have any trouble with this.