I have a Xeon E3-1230 processor, which has 4 physical cores, but has hyperthreading so an operating system running on it sees 8 logical cores.

I installed VMware ESXi and am creating virtual machines to run on it. If I want a virtual machine to be able to run with maximum performance, utilizing the processor to its fullest, should I configure the virtual machine to have 4 cores per socket, since that is the number of physical cores on the underlying machine, or 8 cores per socket, since there are 8 logical cores with the hyperthreading?


The correct answer is "it really depends." vCPU sizing isn't just a case of "more cores = better than"; you need to keep in mind that relaxed co-scheduling can cause your system to run significantly more slowly in cases where you have multiple CPUs but are only stressing some of them. It's essentially the same shoe-shining problem that you might have seen if you've backed up to tape but been unable to supply data quickly enough to keep the tape spinning.

ewwhite is right on the money -- start small, then add more vCPUs if you need them. Benchmark your application, and see for yourself how these changes affect your performance.

Keep in mind that most server-class operating systems support CPU hotplug; if you're unsure if you'll need more CPUs, but don't want to take a downtime hit to enable them, you can enable CPU hotplug in your VM options (if your OS supports it).

  • Thanks. I will do some benchmarking. But I guess I'm still unclear on how hyperthreading affects things. As an example, say I have an application with 8 threads that are constantly doing work on the CPU. On native hardware, the machine shows 8 logical processors, and they are each at 100% CPU. If I run only 1 virtual machine in ESXi, and run this application under it, how many "cores" should I set for this virtual machine in ESXi? 4 or 8? – Nick Apr 18 '12 at 14:37
  • I'm not sure about ESXi 5, but in 4, VMware's official recommendation was to not create a single VM with more than half as many vCPUs as the server has physical cores. In practice, it depends on what other workloads are running on your host. – jgoldschrafe Apr 19 '12 at 22:51

What will your VM be doing? The general advice is to start small on your VMs and configure one or two vCPUs to start, adding more as necessary. Personally, with that CPU, I would not allocate more than 4 vCPUs to a guest VM.

Logical cores are not equivalent to real cores.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.