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?
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?
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.
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.