This is an interesting thing that I have been looking at lately.

Before I start though I should probably clarify terms, so we are all speaking the same language.

In this article when I say Physical CPU, or pCPU, what I am referring to is the logical threads available on the ESXi host. For a 2 socket, quad-core host, this would mean 8pCPUs, if said host is hyperthreaded, that number would then be 16.

When I say vCPU I simply mean the number of CPUs assigned to the guest, or VM.

Great, now that is cleared up let’s keep going.

vCPU to pCPU Ratio is an interesting stat to look at for both looking at current performance in an environment and planning upgrades/expansions. I will say though that this definitely is not an end all be all stat by any means, and for troubleshooting any number of other things, there are far better stats to investigate. As I said this is merely an interesting one to keep in mind.

vCPU to pCPU Ratio is just that. It is a ratio of how many virtual CPUs you are using per each physical CPU.

The next question you should probably be asking is “What is a good/acceptable Ratio to have?”, and I am happy you asked.

The answer, as with pretty much any question IT related is the tried and true:

“It Depends”

It depends on VM workloads, number CPUs assigned to VM, among any number of other variables. I think there are a large number of environments that would be find with 3:1  ratio or even 5:1 ratio. For instance if you have a host with 16 pCPUs and this host has 6 VMs each with 8 vCPUs each (a 3:1 Ratio), it is likely you may have CPU Ready Time issues. Conversely, this same host could have 48 VMs on it each with 1 CPU(again 3:1 ratio) and be perfectly fine. Well it may have 99 other issues but CPU wouldn’t be 1(See what I did there 😉 )

What I am trying to get across is that although this stat might be helpful, it shouldn’t be and no stat should be used to holistically define an environment.

This is however an easier statistic to understand than some others, and it could be helpful explaining CPU issues or non-issues to the non-technical.

Anyway, enough rambling, let’s get to the script.


$vmhosts=Get-VMHost $vmhosts


ForEach ($vmhost in $vmhosts)

$vms |Where-Object {$_.vmhost -like $vmhost}|ForEach {$vcpus+=$_.numcpu}
if ($vcpus -ne "0") {$ratio= "$("{0:N2}" -f ($vcpus/$hostthreads))" + ":1"}

$temp= New-Object psobject
$temp| Add-Member -MemberType Noteproperty "Hostname" -value $
$temp| Add-Member -MemberType Noteproperty "PhysicalThreads" -Value $Hostthreads
$temp| Add-Member -MemberType Noteproperty "vCPUs" -Value $vcpus
$temp| Add-Member -MemberType Noteproperty "Ratio" -Value $ratio



It grabs all the VMs and the Host/s you want, and does the math!

For the first example, I didn’t define a parameter, so it pulled back all the hosts. 3:1 and 1.69:1 seems fine. The last 2 hosts listed didn’t have an VMs running on them.

For this second screenshot, I defined the host when I ran the function, and it returned the 69 host.

Hope this helps or atleast you find it interesting. Below is the full function

[wpfilebase tag=file id=11 /]


Kevin · March 4, 2014 at 7:15 pm

Very cool! I hope to add this data to my graphite server.

aenagy · April 21, 2014 at 11:22 am

Is there a version of this that will do the same for clusters, not just ESXi hosts?

Troy Hicks · November 11, 2014 at 10:22 am

When I run the script I received the following result.

PS C:\Users\username> d:
PS D:\> cd software
PS D:\software> .\getcpuratio.psi
PS D:\software> $output
PS D:\software>

    C-Rad · March 27, 2015 at 9:33 am

    The file name should have a .ps1 extension. Not psi.

    You also shouldn’t need to do $output, the script will display the output for you.

toto · November 25, 2014 at 12:54 pm


I thought that a vCPU is using a Core and not a “Thread”.

Could you confirm ?


    C-Rad · March 27, 2015 at 9:29 am

    Sorry for the delay. vCPUs are mapped to threads.

Leave a Reply