vCPU and logical CPU sizing with Hyper-Threading explained
When sizing virtual machines you should be aware of the number of physical cores available in your ESXi-host and whether or not it has Hyper-Threading enabled. If you blindly follow the number of vCPU's you can add that VMware presents to you, then you could end up with VM's that offer poor performance. If you want to understand Hyper-Threading and why this is important for sizing please read the articles that I have listed at the bottom of this page.
First of all: Hyper-Threading is not necessarily a bad thing. So don't disable it, but make efficient use of the feature and understand what it is and how it impacts the sizing of you VM's.
When looking at an ESXi host's summary tab it will show you the number of Logical Processors that are available. In the image below you see the information about a host with four logical processors available.
When looking at this information you could decide to create virtual machines with four vCPU's because you can. But you shouldn't.
This entire article can be summarized in one sentence: never assign more vCPU's than the number of physical cores your host has. You could also argue that you should leave some headroom in not maximizing the number of physical cores in your VM's but that is beyond the scope of this article.
When opening the CPU summary tab of the host it will show more information about the physical sockets, cores and logical CPU's. As you can see the host has one CPU, two cores and HT enabled. So there are four logical CPU's availalbe.
When creating a VM on this host the maximum number of vCPU's you can choose is four. But you should on this host not create VM's with more than two vCPU's. (The number of physical cores)
By the way: always only use one vCPU in a virtual machine unless there is a use case for multiple vCPU's.
To avoid problems when other administrators than yourself need to create virtual machines use templates with a pre-configured number of virtual CPU's. So a template with one vCPU and one with two vCPU's.
Want to read more about this topic? Here are links to three great articles:
Hyper-Threading Gotcha with Virtual Machine vCPU Sizing by Chris Wahl
When to Overcommit vCPU:pCPU for Monster VMs by Mark Achtemichuk
Will Hyper-Threading Improve Processing Performance? by Bill Jones