VMware Communities
mfeller
Contributor
Contributor

Performance for 1 CPU vs. 2 CPU

I upgraded the CPU, RAM, etc. on my desktop, and installed the latest release of Ubuntu. I have a 5.x version of VMware workstation, and I have been debating on whether or not to upgrade to v6.x, or just go with Virtualbox. Not having worked with VirtualBox, I played around with it a bit. One of the things that I have found is that it is grossly slower to run a 2-CPU virtual machine vs. 1-CPU. I asked about this in a Virtualbox forum, and the response was that the issue is known, and it is being worked on. I don't want to wait, and so I think I will put Virtualbox aside, and go back to VMware.

...But one question first...

Are there any similar performance issues with VMware workstation for 1-CPU vs. 2-CPU virtual machines?

Thanks,

Reply
0 Kudos
20 Replies
continuum
Immortal
Immortal

yes - same problem:

most folks think that more CPUs for a VM means the VM is faster - same disapointment when they find out it is not

___________________________________

VMX-parameters- VMware-liveCD - VM-Sickbay


________________________________________________
Do you need support with a VMFS recovery problem ? - send a message via skype "sanbarrow"
I do not support Workstation 16 at this time ...

Reply
0 Kudos
mfeller
Contributor
Contributor

For a 2-CPU VM, my expectation is that a multi-threaded app inside the VM will be faster...Photoshop in particular is something that I want to speed up.

With Virtualbox, what I am seeing is that the 2-CPU VM itself takes ~2.5x the time to install the guest OS, ~2.5x the time to boot, and is noticeably less "snappy" vs. a single-CPU VM. The usability of the VM is poor enough by comparison that I am not even looking at how applications on the guest are performing.

I want to confirm whether or not this would also be the case for VM workstation VM's.

Thanks!

Reply
0 Kudos
jsa
Enthusiast
Enthusiast

yes - same problem:

most folks think that more CPUs for a VM means the VM is faster - same disapointment when they find out it is not

If he host has more CPUs each VM can have its own CPU, (or two).

For a typical Dual CPU host, two concurrent guests will run much better because each VM will be allocated

to its own CPU. Neither will exceed the speed of a single CPU, but they will not have to run in traffic.

Responsiveness of multiple VMs is DEFINITELY improved on a multi-processor host.

Allocating two CPUs to a VM seems to also improve responsiveness of that VM but I haven't done a

lot of testing on that.

With today's quad processor machines you can run 3 or 4 VMs concurrently and get great performance.

Reply
0 Kudos
GixxerDave
Enthusiast
Enthusiast

When you give a vitual machine a CPU.....you are really giving it a virtual CPU or vCPU !!!

This means it does not get a CPU but shares to use the physical CPU through the virtual layer VM workstation.

So if you have only 1 physical CPU and you give your VM 2 vCPU's it might run slower because of the overhead. Basically don't give more vCPU's then physical CPU's is the standard I use...

Hope this helps....

Reply
0 Kudos
jsa
Enthusiast
Enthusiast

When you give a vitual machine a CPU.....you are really giving it a virtual CPU or vCPU !!!

This means it does not get a CPU but shares to use the physical CPU through the virtual layer VM workstation.

When you give a VM a CPU you give it a task.

That task runs independently of the other cpu. If you watch top on a linux host, press "1" to show individual

cpu loading, and then expand threads, you can see what happens when you busy up a Virtual machine.

Give it one virtual CPU, you have one busy thread. Give it two, and you see two busy threads, which

linux naturally assigns to separate processors. (They move from processor to processor as the

load dictates unless you set affinity).

Reply
0 Kudos
GixxerDave
Enthusiast
Enthusiast

There is a way to set cpu affinity, so that your vm will only use a certain physical cpu. This can be done in Vcenter, but I don't know if it can be done in VM workstation...

But it still hold true that you are only getting "shares" or slices of the CPU pie...

Reply
0 Kudos
jsa
Enthusiast
Enthusiast

In the past there was reason to set affinity. Vmware has solved that, and you never need to do that any more.

However, if your host has multiple CPUs, each machine will be assigned TO different CPUs. (At least till your hosts exceed your CPUs).

Like I pointed out, you can watch this yourself under Linux.

Note that "Assigned TO" does not equate to ownership of.

Reply
0 Kudos
GixxerDave
Enthusiast
Enthusiast

So mfeller, if you have physically 2 CPU's in your computer, then setting the VM to 2 vCPU's should be faster.

If you have 1 physical CPU in your computer, then it's a crap shoot weather setting to 2 vCPU's will be faster then setting to 1 vCPU.

jsa, if you have a 2 CPU computer and create a Linux VM in workstation, does giving the VM 2 vCPU's give it 2 threads, one thread to each physical CPU? Talking with VMWare guys, weather you give this VM 1 or 2 vCPU's will send work to the virtual layer which can use either physical CPU.

As jsa said, assigned to DOES NOT = ownership of when talking about CPU's

Reply
0 Kudos
jsa
Enthusiast
Enthusiast

Talking with VMWare guys, weather you give this VM 1 or 2 vCPU's will send work to the virtual layer which can use either physical CPU.

My understanding is that it can use both physical CPUs, because telling the virtual machine it has two CPUs will cause it to

dispatch two requests at the same time (when the workload dictates) and these requests will be handed off to two separate threads

under the vmware-vmx, and executed potentially on both of the physical CPUs.

But Like I mentioned, I haven't dug all the way down to the bottom of this. I do have a Vista Virtual machine that runs

like a dog under Opensuse until I give it two CPUs. Then its almost usable. (But its still vista, so...)

Reply
0 Kudos
mfeller
Contributor
Contributor

FYI...

In my case I have a quad-core CPU, so there should be no issues with 2 Virtual CPU's having to share time on one real CPU. I also have 8GB RAM, so that the 2GB virtual machine should have plenty of room.

I downloaded and installed the trial version of VMware workstation last night. Boot time for a 2-CPU VM was less than 40 seconds. On Virtualbox, a 1-CPU VM booted in just over 30 seconds, but the 2-CPU VM was close to 2 minutes! So from that quick test, I am inclined to think that VMware is the better option for a multi-CPU VM.

Reply
0 Kudos
GixxerDave
Enthusiast
Enthusiast

Try on the VMware workstation assigning 1 vCPU and see how long it takes to boot. Also do some benchmarking tests inside the VM with the 1 or 2 CPU configuration to see which has the better performance.

Here is the link to best practices for ESX and SMP ...
Here is the link to full release notes for Workstation 5.5 .....
Experimental Support for Two-Way Virtual SMP

For all supported configurations of 32-bit and 64-bit host and guest operating systems running on multiprocessor host machines, Workstation 5.5 provides experimental support for two-way Virtual SMP. This includes any SMP hardware, including dual-core systems and hyper threaded uniprocessor systems.

Guests with more than two virtual processors are not supported in Workstation 5.5. However, you can power on and run multiple two-way Virtual SMP virtual machines concurrently.

You can set the number of processors for the virtual machine in the virtual machine settings editor (VM > Settings), in the Hardware tab under Processors. The number of virtual processors is also displayed in the summary view of the virtual machine. You can also set the number of virtual processors when you create a virtual machine in the New Virtual Machine Wizard. This setting is available only if you choose to create a custom configuration; it does not appear in the typical configuration.

You can assign up to two virtual processors to a virtual machine, in both 32-bit and 64-bit guests. For this experimental feature, Workstation 5.5 allows you to power on and resume two-way Virtual SMP guests only on host machines with at least:

  • A single-processor or multiprocessor host with a dual-core CPU

  • A multiprocessor host with two or more CPUs

  • A single-processor or multiprocessor host with hyper threading enabled
    Note: On hyper threaded uniprocessor hosts, performance of virtual machines with virtual SMP might be sub par.

If the host does not have at least two logical processors, assigning two virtual processors is neither supported nor recommended: a warning message appears. You can disregard this message and assign two virtual processors to the virtual machine, but, once you have finished creating the virtual machine, you might not be able to power it on unless you move it to a host machine with at least two logical processors.

You can use Workstation 5.5 or later, running on a multiprocessor host machine, to open a virtual machine, created in VMware ESX Server, that has one or more virtual processors. However, in Workstation you cannot power on or resume a virtual machine that has more than two virtual processors assigned, even if more processors were assigned when the virtual machine was created in ESX Server.

If you use Workstation to open a virtual machine that has more than two virtual processors assigned, the virtual machine's summary view and the virtual machine settings editor (VM > Settings) display the number of processors as Other (x), where x is the number of processors originally assigned in ESX Server. Workstation preserves this original configuration setting for the number of processors, even though two is the maximum number of processors supported. You must change this setting to two processors before you can power on the virtual machine in Workstation. Note that once you commit a change to this setting, by clicking OK in VM > Settings, the original setting for number of processors is discarded, and no longer appears as an option in VM > Settings.

Virtual machines with Virtual SMP are supported only for Workstation version 5.5. A virtual machine created in Workstation version 5.5 with two virtual processors cannot be powered on or resumed in Workstation versions 5.0 and earlier. Also, if you suspend an SMP guest in Workstation 5.5, you cannot resume the virtual machine in Workstation 5.0 and earlier versions.

http://www.vmware.com/support/ws55/doc/releasenotes_ws55.html#before

Reply
0 Kudos
popej
Contributor
Contributor

My host is Vista x64 on Quad Core, guest Centos 5.3 32-bit. I measured compilation time of my software in guest, time in seconds:

vCPU number:

1

2

4

VMWare 6.5.3

74

40

22

VirtuaBox 3.0.6b1

95

54

46

I'm afraid VirtualBox 3.0 isn't stable yet. I had problems with VM installation, virtual network adapter, random compiler errors. VMware is much more reliable.

Reply
0 Kudos
jsa
Enthusiast
Enthusiast

My host is Vista x64 on Quad Core, guest Centos 5.3 32-bit. I measured compilation time of my software in guest, time in seconds:

|vCPU number:|1|2|4|

|VMWare 6.5.3|74|40|22|

|VirtuaBox 3.0.6b1|95|54|46|

How did you come up with a 4 cpu measurement when Vmware only allows 2 CPUs per virtual machine?

Reply
0 Kudos
popej
Contributor
Contributor

I edited *.vmx file with text editor. This line:

numvcpus = "4"

Reply
0 Kudos
jsa
Enthusiast
Enthusiast

Sneaky.

And it seems to work too.

Reply
0 Kudos
Jatz
Contributor
Contributor

I have a Windows7 host running VM's of XP. My processor is a duocore. If I set the VM to use one processor the taskmanager on the physical machine shows around 56% CPU usage under full load from the VM. The taskmanager in the VM shows 100% usage. This would seem that the VM is only running on one core. When I changed the VM to use 2 processors my physical machine shows a higher CPU usage (close to 90%) under full VM load. The VM shows 2 CPU's but under full load they only acheive around 55% max. All in all in both setup the VM seems to run the same speed which by the way is slower then when run on a Vista or XP host. It would seem that VM is not fully utilising the available processing power. The VM runs fine on other physical machines on non Windows7 host. Guess VM is not fully compatible with Win7 Smiley Sad

Reply
0 Kudos
John_Leask
Contributor
Contributor

From what I remember, if you have a 2 core system, then your best bet is only to assign a single core to the VM.

The problem is that if you assign both cores to the VM, then both cores need to be available for the host OS to be able to schedule the VM to run, so depending on the load in the host, the guest might not get to run as much as it needs, and so it ends up slower than if a single core was assigned.

My own experience on a 2 core system (dual single core Xeons) showed this - I'd tried assigning both cores to speed up the VM, but it ended up slowing it down badly at times, and so wasn't worth it.

Reply
0 Kudos
mfeller
Contributor
Contributor

I have a quad-core CPU. My plan is to run a 2-CPU VM for workstation-type tasks where performance is more of a consideration, and then maybe one or two small 1-CPU "service" VM's in the background. I expect the background VM's to be light loads, so I don't have performance concerns for those VM's plus the host OS sharing the 2 CPU's not in use by the workstation VM.

Reply
0 Kudos
mfeller
Contributor
Contributor

Out of curiosity, is your host Intel or AMD? The VirtualBox IO-APIC performance issue is only for AMD hosts.

Reply
0 Kudos