VMware Communities
slb
Contributor
Contributor

Are you using 1 or 2 processors?

Just curious if people are using 1 or 2 virtual processors in their setups?

I've tried 1 & 2 on my Mac Pro (2x3 Xeons, 4GB RAM) and it didn't "feel" any better.

Haven't tried 2 with my MacBook Pro (2.33, 2GB RAM) yet.

Do you see better performance using 2? My Mac Pro seemed to bog down. Granted, I was at the end of my day, and didn't fine-tune everything, so I may have to revisit.

Reply
0 Kudos
21 Replies
dp_fusion
Enthusiast
Enthusiast

I'm using two for no particular reason. The only VM running the last few days is XP and it's only running IE for webmail. No problems so far. My Mac is quite responsive, but the CPU's have quite a bit of idle time. I'm using a laptop and it's running a bit warmer with Beta 3 than with Beta 2 but not enough to get me to adjust the fans.

Reply
0 Kudos
rcardona2k
Immortal
Immortal

I'm using two virtual processors in all of my XP images, including my Boot Camp partitions and it does benchmark better than a single processor VM. The only time I really notice a difference is with responsiveness of the guest when I'm running a build and the VM would normally be completely tied up.

Reply
0 Kudos
spfthink
Contributor
Contributor

I'm using 2 processores and 1GB RAM. Beta 3 (without logging) seems to fly now. I upgraded to Office 2007 Pro last night and this runs perfectly. Also, my average CPU on the Macbook Pro seems to tick over at at between 30-50% under Fusion, which is some 20% less than the average under Parallels.

I am going to use Fusion instead of Parallels for work this week, to give it a run in 'real' environment.

Steve

Reply
0 Kudos
blackpuma
Contributor
Contributor

Speaking in general, do note that when one switches from uni-processor to SMP, one won't see a dramatic improvement in performance when puttering around the OS. You should see an improvement in how the machine reacts to stress, however. The degree of improvement depends on the OS in question. I've found Linux to take greater advantage of SMP than Windows in general; meaning, I can throw more at Linux before it bogs down than I can Widnows.

I just enabled the second processor so I can debug an SMP issue in our software. There's a small but noticable difference as I'd expect. I've not given the VM a good workout though, so I can't comment on how well the VM performs under stress.

MacBook Pro (2.16GHz Intel Core Duo), 2GB RAM

Running VMs from an external Firewire 400 hard drive.

Reply
0 Kudos
mu3rt3
Contributor
Contributor

For what it's worth, when I've spoken to VMware engineers about this, they have all told me to use 1 processor in VM's running on my dual core MacBook Pro.

Reply
0 Kudos
Andreas_Masur
Expert
Expert

For what it's worth, when I've spoken to VMware

engineers about this, they have all told me to use 1

processor in VM's running on my dual core MacBook Pro.

Well....were they the same engineers that are present in this forum? I really would like to hear their reasons behind this statement since this does not make sense to me right away. Of course, it may be the due to the desing of the layer for virtual CPU support but still...

Ciao, Andreas

Reply
0 Kudos
SMB1
Expert
Expert

The reasoning behind it is so a busy VM can not grab so much of the machines available resources that it ends up choking itself. As a hosted product Fusion, any apps running in OS X and OS X itself need access to processor time as well. By 'limiting' the VM to one processor you leave one free for the system to do its thing.

/not a VMware engineer but those are the reasons given when trying to decide whether or not to use vSMP on the Server product.

Reply
0 Kudos
blackpuma
Contributor
Contributor

The rule of thumb I'd apply is, "unless you really need to do otherwise, leave one processor available to the host."

Note that's a rule of thumb. I regularly run twor or three mostly-idle VMs in the background. They burn up some CPU time idling, but they don't seem to unduly interfere with the VMs that need some "oomph." I count their idle time as leaving a CPU more or less available.

Where they do impact the system is the RAM they burn up. I like to leave lots of RAM available for disk caching. (I have a daily-used VM that loves to read from the same areas of disk.)

I'm not a VMware engineer either. I'm speaking from experience as a VMware user on SMP machines as well as a computer scientist and software engineer who's worked a fair bit with parallelism.

Reply
0 Kudos
blackpuma
Contributor
Contributor

Sorry to reply to myself.

To clarify, when I say "processor" I mean "CPU" not "package of silicon"... i.e. a core on a multi-core system. I didn't mean in imply leave an entire multi-core IC idle. Just \*one* of the CPU cores. Smiley Happy

Yeah, in my mind a multi-core IC is fundamentally the same as multiple single-core CPUs.

Ahem... so, "unless you really need to do otherwise, leave one CPU/core available to the host." If you have two dual-core processors, leave one of the four cores available to the host.

Reply
0 Kudos
admin
Immortal
Immortal

I'm not a VMware engineer either, but I am a VMware professional-services guy. In our training classes on other VMware products, here's what we say about the choice of how many virtual CPUs (this advice applies just as well to Fusion).

Choose a number of VCPUs based on the application you plan to run in the VM. For casual desktop use, you may not notice a performance improvement with 2 VCPUs. But if you're running a multithreaded or multiprocess server, or some multithreaded application, the odds are in your favor. For example, if you're developing software, your development environment is probably capable of parallelizing builds when more than one CPU is present. If you're running an Apache web server, the httpd processes will get spread out across the available CPUs.

A multi-VCPU VM does incur a bit more overhead than a single-VCPU VM. Although the multi-VCPU VM does need a bit more memory overhead, the main thing to consider is scheduler overhead. The VCPUs must be co-scheduled onto the physical hardware execution contexts (for example, the two cores in a single Core Duo). "Co-scheduled" means that they both must be running when either is running. If you only have two hardware execution contexts, nothing else on the Mac can be running during the VM's timeslice (in the millisecond range). That doesn't halt the other Mac apps' progress; it just requires them to run in round-robin with the VM.

Bottom line: One-VCPU VMs are best for random, casual desktop use, especially when you're also going to be doing serious work on the host at the same time as the VM. Two-VCPU VMs (and, on ESX Server only, four-VCPU VMs) are best for multi-threaded applications in the VM. The more cores your host has, the less scheduler contention will be a risk.

Now that I've said all that, I should mention that plenty of people run 2-VCPU VMs on hosts with 2 cores and are happy with the result. It all comes down to your pattern of application usage.

And, frankly, if you care about performance, this issue is secondary in importance. The #1 thing is to make sure that neither the guest nor the host is paging in and out.

Reply
0 Kudos
ksc
VMware Employee
VMware Employee

Well....were they the same engineers that are present

in this forum? I really would like to hear their

reasons behind this statement since this does not

make sense to me right away. Of course, it may be the

due to the desing of the layer for virtual CPU

support but still...

I'm one of the engineers who does touch this code on occasion. So to quickly get technical...

The very rough story is you'll get better performance out of two 1P VMs than out of one 2P VM, because getting processors to synchronize is somewhat wasteful and very much non-deterministic. (Some machines get a good 95% gain; rare machines do 80% worse as the OS's scheduler copes with load by doing things that prevent synchronization; average is probably in the 50-80% gain range). A 1P VM acts just like a normal application, which your host OS knows how to schedule quite well. A 2P VM is a different beast. Quick summary: 2P usually works fine, and "usually" translates to "experimental support".

It's a scheduling problem - if one vCPU needs to wait for another ("spinlock" to anyone who studies kernels), we literally have to wait for the OS's scheduler to put a specific thread on a different core. There are a lot of scheduling combinations we might get; most are useful but many are not. OSes are designed to assume "spinlocks" always run fast, so they busy-wait; if we have to wait a whole host scheduler tick to get a better schedule before we can process a spinlock, the guest OS ends up stuck in an interrupt handler, has used up the host scheduler's timeslice, and hasn't make forward progress. More processors on the host and less workload on the host make good schedules statistically more likely.

If you need every bit of all those processors, well, you probably need ESX (which doesn't waste performance, because there is no host OS scheduler to get in the way). That said, the current vSMP is more than enough for many purposes (i.e. getting an SMP system).

And if this explanation got too technical ... well, the recommendation I've always passed around is to use 1P unless you have a specific need for 2P.

Reply
0 Kudos
Stefsun
Contributor
Contributor

I am no engineer, but on my MacBook Pro (Core2Duo), when I enable 2 virtual CPUs performance gets worse, especially in graphics and video, (which isn't too fast even with a single cpu).

Any explanation for that?

Message was edited by:

Stefsun

Reply
0 Kudos
rcardona2k
Immortal
Immortal

>I enable 2 virtual CPUs performance gets worse, especially in graphics and video

Most OS's don't recognize an additional processor automatically. Changing the number of virtual processors requires re-configuring or repairing the guest OS to utilize the second processor. You may be incuring some overhead from enabling but not having the guest OS exploit the second processor. For instance in Windows, in the task manager do you see two processor utilization graphs? If not, Windows is not taking advantage of the second processor, yet you are paying overhead for it.

Reply
0 Kudos
Stefsun
Contributor
Contributor

Yes I do see two processors in Task manager. I am using a Bootcamp partition, and in Fusion the guest VM stays configured as ACPI Multiprocessor PC. When I configure Fusion to use 2 CPUs though, the 2D graphics loose half their speed, and the system seems slower in general. (Core2 Duo Macbook Pro)

Reply
0 Kudos
Linh_My
Enthusiast
Enthusiast

Currently except for a dual Xenon box that displays (somewhat deceptively) as 4 CPUs, all I have is one or two CPU boxes. So I leave one CPU for the hoast and that leaves one for the guest. Note on the *nixes that I use, it is nessassary to recompile the kernel from uni to SMP inorder to use multipul CPUs. I sort of remember some way of changing the Windows kernel from uni to SMP with out a reinstall.

Reply
0 Kudos
Andreas_Masur
Expert
Expert

Bottom line: One-VCPU VMs are best for random, casual

desktop use, especially when you're also going to be

doing serious work on the host at the same time as

the VM. Two-VCPU VMs (and, on ESX Server only,

four-VCPU VMs) are best for multi-threaded

applications in the VM. The more cores your host

has, the less scheduler contention will be a risk.

Brian,

first of all thank you uvery much for providing your extensive answer. Everything you said is well understood and reasonable. I am not necessarely looking for the best performance (in this case I will boot into BootCamp Smiley Wink ), I was simploy trying to understand what impact there could be using at least a dual-core CPU. Having a virtual machine using 2 vCPUs that need to deal with one physical CPU only is of course quite more complex than having two physical cores in the first place.

However, my question was rather geared towards the scenario of having two physical cores as well as two virtual CPUs in the virtual machine.

Thanks again.

Ciao, Andreas

Reply
0 Kudos
Andreas_Masur
Expert
Expert

I'm one of the engineers who does touch this code on

occasion. So to quickly get technical...

Thank you very much for your answer....this was what I was hoping for. I agree....I did not think about the spinlocks that can occur within the virtual machine and its CPUs. Second thing I do not know in detail is the way you actually can influence the scheduler of Mac OS itself to optimize these kind of situations. Probably not that much as with many other operating systems either.

I am not in desperate need of any processor cycle, I am pretty much relying on the SMP functionality of Fusion since it greatly helps in developing and - even more important - debugging multithreaded applications. It is usually pretty hard to do this on a single-processor system... Smiley Wink

Thanks again for the valuable information....very much appreciated.

Ciao, Andreas

Reply
0 Kudos
admin
Immortal
Immortal

I'm pretty sure Brian was addressing your question of the 2 vCPUs on a dual-core machine - substitute "core" for CPU, since he's really talking about processor units. After all, a 2 vCPU virtual machine isn't presenting two dual-core processors to the guest.

Reply
0 Kudos
Andreas_Masur
Expert
Expert

I'm pretty sure Brian was addressing your question of

the 2 vCPUs on a dual-core machine - substitute

"core" for CPU, since he's really talking about

processor units. After all, a 2 vCPU virtual machine

isn't presenting two dual-core processors to the

guest.

Eric,

You are quite right....this was my mistake....after re-reading his answer I was realizing that I got messed up with the Core Duo. This is already a dual-core CPU and I was thinking of it as a single-core one...Intel produces too many new CPUs in a too short timeframe...I cannot differentiate all the Core Duo, Core 2 Duo, Core XY Duo, Extreme Core Duo and so on.... Smiley Happy

My apologies...

Ciao, Andreas

Reply
0 Kudos