VMware Communities
nkaufman
Enthusiast
Enthusiast

VM Guest CPU/Core etc. Question

From manual:

"When you select a custom configuration, the New Virtual Machine wizard prompts you to specify the number

of processors for the virtual machine.

Specifying multiple virtual processors is supported only on host machines that have at least two logical

processors. Single-processor hosts that have hyperthreading enabled or dual-core CPUs are considered to have

two logical processors. Multiprocessor hosts that have two CPUs are considered to have two logical processors,

regardless of whether they are dual-core or have hyperthreading enabled."

So, for a i7-6820HQ machine (that I'm planning to get) that has 4 cores and support HT, we should see 8 logical processors.


What are optimum settings for VM->Settings->Processors->Number of Processors/Cores, if I'd like to use 4 logical processors?

Would VM still see one processor and 8 cores? or 4 processors with 2 cores each? or 1 processor and 4 cores (ignoring HT)?

If I have multiple VMs running and would like to assign 2 logical processor to VM1, 4 logical processor to VM2, and 2 logical processors to Host, how would I accomplish that, if it is even possible to do that?  If not possible to allocate like this then what is the allocation to achieve something similar result?


Thanks,



10 Replies
nkaufman
Enthusiast
Enthusiast

Have been going over some postings on this site but this cpu/core w/HT allocation seems to be quite confusing.

0 Kudos
nkaufman
Enthusiast
Enthusiast

Bumping this as i find it difficult to believe that in the current computing world of multi-core/multi-threaded cpus, people have not come across the question of how many cpus/cores etc. does a VM see for quad core HT cpu.

does the VM see

8 cores - 4 cores. 4 HT

or something else?

Thanks,

0 Kudos
wila
Immortal
Immortal

Hi,

On the CPU that you mention you would be able to select up to 8 virtual CPU's.

The decision on how-to divvy that up - 1 cpu with 8 cores, or 8 CPU's with 1 core is mostly irrelevant and the area where it counts most is licensing (eg. software that is licensed per CPU)

Doing so however would starve the host from CPU resources, so your guest would not really run well either (as it depends on the host being able to run well)

You could indeed setup a guest with 4 CPU's. But experience learns that "less is more" and as a golden rule you should try to start out as minimal as possible.

It is a VM so it is not that hard to add another CPU if you think it will help.

Another note is that CPU resources need to be scheduled and scheduling 4 CPUs is more difficult as just 1 or 2 CPUs.

Also note that a hyper threaded CPU isn't really a CPU core and while it is being advertised as one, it is mostly just that.. marketing.

It might help for your applications, but when we're talking about virtualisation it doesn't carry as much weight.

So my recommendation for your host is to stay under 4 CPU's per guest.

--

Wil

| Author of Vimalin. The virtual machine Backup app for VMware Fusion, VMware Workstation and Player |
| More info at vimalin.com | Twitter @wilva
0 Kudos
nkaufman
Enthusiast
Enthusiast

Thank you for the reply.

So, in Vm->Settings, I see the following when I select 'Processors' in the left panel:

Number of Processors:

Number of Cores per Processor:

For a quad core processor with HT, what will I see in each of these fields? Will I see 4 Processors (for Quad Core) and then 2 cores per Processor (for HT)?

Or did you mean that I would see 8 Processors with 1 core per Processor?

Am wondering what the numbers are in the above 2 fields and how are they calculated.

My requirement is to have multiple VMs running

- Most work done on VM1

- Then comes Host

- VM2 least amount of work

and was wondering what the optimal solution is to distribute Number of Processors and Number of Cores per Processor.

Thanks,

0 Kudos
wila
Immortal
Immortal

Hi,

You can configure your VM to use 8 cores in different ways:

For example, configure as 8 processors (also called sockets) of each 1 core:

pastedImage_0.png

here's an example of 1 processor with 8 cores:

pastedImage_1.png

You can even configure more as what the host has, but you can't power it on:

pastedImage_2.png

For performance it doesn't matter how you mix and match your number of cores/processors.

There's no recommended type of configuration over another one.

The main reason you have this option is to be able to comply with products that use processor count licensing as mentioned earlier.

I've got a similar setup and most of my VMs are single core, just one CPU assigned.

The VMs that I use which are multi core run software that can benefit from that, such as SQL Servers.

Most software out there is not optimized for multiple processors, so adding more processors quite often just makes scheduling more difficult and results in non responsive VMs.

One could argue however for assigning 2 cores as then when one process ties up a core and another process asks for CPU time it can use the second core.

So in my point of view your optimal processor count for your VMs is likely to be 2 cores and if your heavy duty VM requires really a lot of CPU (think video rendering, database servers etc..) then perhaps 3 cores.

--

Wil

| Author of Vimalin. The virtual machine Backup app for VMware Fusion, VMware Workstation and Player |
| More info at vimalin.com | Twitter @wilva
nkaufman
Enthusiast
Enthusiast

Hello,

Thank you for clarifying that the difference between number of cores/processors in VM settings is for products that need them for licensing etc.

When you use only ONE cpu on your VMs, how is the performance? It is as if one bought a laptop with 1/8th of the quad-core HT CPU, isn't it?

I'd be running Visual Studio IDE, SQL Server or Oracle, MS Office etc. in VM1. Hence was thinking of 4 for VM1, 2 for VM2 (light browsing/testing) and 2 for Host (mostly for personal stuff/email etc).

Thanks again.

0 Kudos
wila
Immortal
Immortal

Hi,

Performance is good. Look in your task manager of your windows machine and see how much CPU you normally use and how many cores.

You do not often run out of CPU and hardly ever more as a single core is being used.

Look at it this way, your host is scheduling the CPUs, your guest can use what is free.

To give a small example:

In the hypothetical case that your host is using 5 cores and your guest is configured for 4 cores then .. something is going to be slow, most likely all of them.

Now imagine having 2 guests with 4 cores and your host wants to use a core too...

This is a layman example as in that it isn't exactly how it works, depending on multiple factors the CPU scheduler and hypervisor can make smart decisions on how-to schedule the CPU, but it does paint the picture a bit.

Especially it highlights that it is more difficult for the hypervisor and CPU scheduler to schedule the CPU for a VM with 4 cores as it is for a VM with 2 cores.

VMs will end up waiting on each other and not be able to do anything even if there are 3 cores available.

So yes a VM with 4 cores might be able to use more CPU, but the more likely scenario is that you are adding extra lag.

Most VMs will not actually be able to use the more cores as normal desktop software isn't optimized for multi-core use.

Exceptions to that are things like SQL Server and Oracle, they actually know how-to use multiple cores.

So yes for them it might make sense to use 2 cores (I sure do)

Other examples are video rendering, that also is a process capable of using multiple cores at once.

--
Wil

| Author of Vimalin. The virtual machine Backup app for VMware Fusion, VMware Workstation and Player |
| More info at vimalin.com | Twitter @wilva
0 Kudos
nkaufman
Enthusiast
Enthusiast

Hello,

I think there are 2 different points being raised here.

(1) Yes, most programs are written for single cores and not multiple cores

(2) Having said that, the OS will allocate threads to different cores thus utilizing multi-core and making the system more responsive.

Following picture shows CPU usage of my VM with 1 cpu and 2 cores assigned to it:

VM-CPU-Usage.PNG

So I am not convinced having only ONE core per VM is that helpful. And this snapshot does not take the times when the development tasks are being run, automated testing being run etc. In those cases, cpu usage would be higher and hence I think assigning multi-cores will definitely help improve system performance.

Of course, I never meant to assign all 8 cores to VMs and leave none for the host. My planned assignment (see OP) was:

VM1 - 4 cores

VM2- 2 cores

leaving Host with 2 cores

Thanks,

0 Kudos
wila
Immortal
Immortal

Hi,

Yes that is what I've been trying to say.

I recommend to start out with 1 core as it is easy to scale up and see if it helps your particular use case.

While users hardly ever scale down, scaling up is quickly done. Depending on load/use case both can help.

PS: "leaving the host 2 cores"  it's not exactly how it works as you can actually over provision.

Eg. on a 8 core system you can run 12 vCPUs without problems as long  as you don't end up having VMs that try to gobble up all of the cores at once and as long as not all the VMs are running at high load.

To illustrate it should work fine with VMs provisioned with 6 dual core vCPUs, but I would expect a lot more latency if you use 3 VMs provisioned with quad core CPUs.

The "it all depends" is still there as it all depends a bit on the actual workload.

--

Wil

| Author of Vimalin. The virtual machine Backup app for VMware Fusion, VMware Workstation and Player |
| More info at vimalin.com | Twitter @wilva
0 Kudos
ricky89
Enthusiast
Enthusiast

So I can install up to 16 cores only 1 physical processor with 4 cores and (8 logical) optimization are excellent having put 16 cores?

0 Kudos