2

Is it better to run a VM on a dual core hyperthreaded machine as a four core or as a two core VM.

The hyperthreaded 'virtual' cores are not as fast as the real cores. Does this effect the VM?

gbrandt
  • 147
  • 10

2 Answers2

2

You don't mention a hypervisor but whichever you're dealing with be careful to not needlessly over-allocate vCPUs - the reason is that the hypervisor won't allow the VM to execute ANY code until ALL of the assigned vCPUs are ready - this means that your VM can be sat around for huge amounts of time - just assign what you need, it's easy to add later.

Oh and as for your question, if you have the choice always allocate the cores and threads in correct proportion to your actual host hardware - i.e. in this case give it two core with four threads, not four cores or four threads - modern guest tools will know how best to utilise these if described more accurately.

Chopper3
  • 101,299
  • 9
  • 108
  • 239
  • The scheduling problem can cause significant stalling in VM's but it's not quite as strict as this on all Hypervisors. ESX V3 introduced a more relaxed co-scheduling behaviour ( http://communities.vmware.com/docs/DOC-4960;jsessionid=1F471197905D5DF064BD4FF2D3206281 ) which allows some amount of skew between vCPU's. The general principle still applies though - avoid adding extra vCPU's unless absolutely necessary because they make scheduling harder. – Helvick May 06 '10 at 22:37
  • @Chopper3 Can you tell me how I can allocate 1 VCPU and 2 threads to a KVM virtual machine? – Nickolai Leschov May 04 '14 at 00:26
1

The same as running an application on a physical machine with hyperthreading, the answer depends on the application, and sometimes even more on how the application is used. With MS SQL Server, for instance, some databases benefit hugely from hyperthreading, and some perform worse.

Best thing to do is try it both ways if possible, establish some benchmarks and see what real world results are.

SqlACID
  • 2,176
  • 18
  • 18