VirtualBox vs Hyper-V AMD/Intel big performance difference

Discussions about using Windows guests in VirtualBox.

Re: VirtualBox vs Hyper-V AMD/Intel big performance difference

Postby Petr Vones » 27. Jul 2021, 20:32

Now the real daily usage scenarios. I noticed the performance difference on the old i5-2540M first where it is most visible and easily measured by the CPU-Z. But running the unit test that are mostly CPU bound, but some of them (the 20 seconds plus ones) can be also I/O bound because use SQL Server, gives more realistic comparison. VirtualBox is still 50% slower overall than Hyper-V on both Intel laptops, but has almost identical performance on the AMD Ryzen 5 3600. Maybe because of the very fast SSD there? Also notice the Hyper-V on i5-2540M is faster than VirtualBox on i5-8265U. Weird.

tests.png
tests.png (92.77 KiB) Viewed 1982 times
Petr Vones
 
Posts: 87
Joined: 27. Dec 2012, 01:20
Location: Czech Republic
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows 10 64-bit

Re: VirtualBox vs Hyper-V AMD/Intel big performance difference

Postby Petr Vones » 27. Jul 2021, 21:10

I used the Session Information - Performance Monitor to check how much I/O bound the tests are and it is clear it is much more CPU bound. But there is an interesting difference between the Intel and AMD. On the Intel Core i5-8265U the VMM Load is very high, higher than Guest Load while on AMD Ryzen 5 3600 the VMM Load is almost zero.

pmIntel.png
pmIntel.png (100.32 KiB) Viewed 1970 times


pmAMD.png
pmAMD.png (52 KiB) Viewed 1970 times
Petr Vones
 
Posts: 87
Joined: 27. Dec 2012, 01:20
Location: Czech Republic
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows 10 64-bit

Re: VirtualBox vs Hyper-V AMD/Intel big performance difference

Postby fth0 » 27. Jul 2021, 22:45

Thank you for the statistics and the performance graphs, which clarify what you always stated. As you already guessed yourself, the blue VMM Load part of the CPU Load is what we should be after. BTW, the 5th graph (missing in the screenshots) shows the VM-exit counts and would have been interesting, too.

As a next step, I'd suggest the following procedure: Please run the VM three times (preferably, but not necessarily on the i5-8265U, with an otherwise idle host OS), according to the following instructions, and provide the VBox.log files:

1. Start a stopwatch, start the VM, wait for approximately 3 minutes, and shut down the VM from within the guest OS. This will give the 1st baseline statistics.

2. Start a stopwatch, start the VM, wait for approximately 3 + <n> minutes, and shut down the VM from within the guest OS. This will give the 2nd baseline statistics. Use the value <n> from the 3rd run below.

3. Start a stopwatch, start the VM, wait for approximately 3 minutes, do a test phase of <n> minutes, and shut down the VM from within the guest OS. In the test phase, it would be best if you could execute a single test multiple times so that it takes at least 3 minutes. When selecting the test, perhaps you can choose a test that you deem CPU bound and that takes at least several seconds with t(2V) >> t(2H). This will give the statistics to compare with the two baseline statistics.

I'm curious what we'll discover ... :)

PS: During the + <n> minutes of the 2nd VM run, which are supposed to measure an idle period, take a short peek into the Performance Monitor, to check if the VMM Load is possibly always there.
fth0
Volunteer
 
Posts: 2380
Joined: 14. Feb 2019, 03:06
Location: Germany
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Linux, Windows 10, ...

Re: VirtualBox vs Hyper-V AMD/Intel big performance difference

Postby Petr Vones » 28. Jul 2021, 09:29

fth0 wrote:the blue VMM Load part of the CPU Load is what we should be after.

It is actually easy to reproduce. When the guest is idle, the performace chart reports constantly VMM Load around 50 percent and Guest Load <3 percent on both Intel machines. The VM Exits value is around 10k. When you run a high CPU load task, the VMM Load drops in favor of the Guest Load. When I run the Visual Studio and let it idle for few minutes, the VMM Load goes up to 80 percent, Guest Load is 5 percent and VM Exits around 50k. It is a question whether the CPU Load stats are correct on Intel :?

On the AMD machine the VMM Load is zero when the guest is idle and <5 percent when use the Visual Studio. The VM Exits values are similar to the Intel machines.

The log files of these three tests attached.
Attachments
ThreeTests.zip
(97.25 KiB) Downloaded 2 times
Petr Vones
 
Posts: 87
Joined: 27. Dec 2012, 01:20
Location: Czech Republic
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows 10 64-bit

Re: VirtualBox vs Hyper-V AMD/Intel big performance difference

Postby fth0 » 28. Jul 2021, 13:00

Petr Vones wrote:When the guest is idle, the performace chart reports constantly VMM Load around 50 percent and Guest Load <3 percent on both Intel machines. The VM Exits value is around 10k.

I can confirm that this also holds true on my own idle setup, with a small difference: In your graph, the red and blue lines have parallel spikes, whereas in my graph, the spikes are somewhat symmetrical (e.g. 10% Guest Load show from 47% to 57%, and 20% Guest Load show from 44% to 64%). The host OS doesn't show any CPU load corresponding to the 50% VMM Load, and CPU-Z also shows half of the CPU clock (1800 MHz vs. 3600 MHz) in my case, so I think we can conclude that the 50% VMM Load are a virtual (non-existing) load. I'll consider that when looking at your test results later on ...
fth0
Volunteer
 
Posts: 2380
Joined: 14. Feb 2019, 03:06
Location: Germany
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Linux, Windows 10, ...

Re: VirtualBox vs Hyper-V AMD/Intel big performance difference

Postby Petr Vones » 28. Jul 2021, 14:04

Yep, there is something wrong on the Intel hardware, either the virtualization engine or the CPU Load statistics (or both). It behaves as expected on AMD, including the correct CPU clock speed in guest reported by Task Manager (unlike the Intel where the value is lower).
Petr Vones
 
Posts: 87
Joined: 27. Dec 2012, 01:20
Location: Czech Republic
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows 10 64-bit

Re: VirtualBox vs Hyper-V AMD/Intel big performance difference

Postby TPF » 4. Aug 2021, 14:05

Hello,

It may be a redundancy but check on the Intel equipment that the parameters required by Virtualbox in for the processor in BIOS are supported by each of those processors and, also, activated.

Grretings
TPF
 
Posts: 4
Joined: 1. Aug 2021, 11:52

Re: VirtualBox vs Hyper-V AMD/Intel big performance difference

Postby Petr Vones » 5. Sep 2021, 11:23

fth0 wrote:I can confirm that this also holds true on my own idle setup

Is there a chance to fix it?
Petr Vones
 
Posts: 87
Joined: 27. Dec 2012, 01:20
Location: Czech Republic
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows 10 64-bit

Re: VirtualBox vs Hyper-V AMD/Intel big performance difference

Postby fth0 » 5. Sep 2021, 23:14

@Petr Vones: First of all: Apologies for not answering until now!

I have the log files of the "three tests" still open on my virtual desktop #12 (VirtualBox is on #11). When I first looked at them, I couldn't discover what I had hoped to find, because those statistics are difficult to interpret, even though I roughly know what they mean. So this had to wait for a flash of inspiration.

Lately, several users have reported the high VMM Load displayed in the Performance Monitor (e.g. 20525, 20526), so (not) by coincidence, I've investigated it a bit today:

VirtualBox counts the realtime in three nanosecond counters called cNsExecuting, cNsHalted and cNsOther. The first two sum up the times when the guest OS is executed and halted respectively. The third counter sums up the times when either VirtualBox itself is doing "something else" or when VirtualBox is not active at all (and the guest OS is not in the halted state). This "something else" is difficult to grasp, because it hides in the majority of the VirtualBox code.

In the Performance Monitor, the Guest Load represents the increment of cNsExecuting, and the VMM Load represents the increment of cNsOther. Since the CPU load both in the guest OS and in the host OS seem to not reflect this VMM Load, I don't expect this issue to have a high priority for the VirtualBox development.

I'll have to check the log files of the "three tests" again with my newly accumulated knowledge ... feel free to remind me after a week ...
fth0
Volunteer
 
Posts: 2380
Joined: 14. Feb 2019, 03:06
Location: Germany
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Linux, Windows 10, ...

Re: VirtualBox vs Hyper-V AMD/Intel big performance difference

Postby Petr Vones » 6. Sep 2021, 22:47

fth0 wrote:@Petr Vones: First of all: Apologies for not answering until now!

No problem, holiday time :)

fth0 wrote:I don't expect this issue to have a high priority for the VirtualBox development.

Basically I expect a "Move to Hyper-V on Intel CPU to get decent performance" resolution :?
Petr Vones
 
Posts: 87
Joined: 27. Dec 2012, 01:20
Location: Czech Republic
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows 10 64-bit

Re: VirtualBox vs Hyper-V AMD/Intel big performance difference

Postby fth0 » 10. Sep 2021, 23:22

Regarding the VMM Load display, the VirtualBox devs thought that it was a statistics glitch, but they could not explain why there would be a difference between Intel and AMD CPUs. The statistics counters in VirtualBox release builds do not suffice to show where the problem is exactly, so a VirtualBox dev would have to trace the VirtualBox inner execution loop in R0 using a VirtualBox debug build. As long as this issue is considered a statistics glitch, I wouldn't expect that to happen soon.

Regarding the performance issue, I could not explain it with the statistics data either, and also could not link it to the VMM Load issue (the Intel vs. AMD CPU dependency is only an indication, but not a proof). Therefore, I'd suggest to create a ticket in the Bugtracker.
fth0
Volunteer
 
Posts: 2380
Joined: 14. Feb 2019, 03:06
Location: Germany
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Linux, Windows 10, ...

Re: VirtualBox vs Hyper-V AMD/Intel big performance difference

Postby Petr Vones » 14. Sep 2021, 09:06

fth0 wrote:Therefore, I'd suggest to create a ticket in the Bugtracker.

Done https://www.virtualbox.org/ticket/20548
Petr Vones
 
Posts: 87
Joined: 27. Dec 2012, 01:20
Location: Czech Republic
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows 10 64-bit

Re: VirtualBox vs Hyper-V AMD/Intel big performance difference

Postby eebssk1 » 14. Sep 2021, 14:13

Maybe try benchmark on 6.1.18 which doesn't have the weired statistics bug?
eebssk1
 
Posts: 3
Joined: 14. Sep 2021, 14:12
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Debian 10

Re: VirtualBox vs Hyper-V AMD/Intel big performance difference

Postby eebssk1 » 14. Sep 2021, 15:48

So I done a quick sysbench for both VB and Hyperv on Debian10. The result is very smilar but VB is a little bit faster than Hyperv(maybe just jitter.)
Haven't do compare for windows yet but I think i don't need to because Windows10 LTSC is noticeblely lag in VB here.
I5-9300H
VB test 6.1.27 146688
eebssk1
 
Posts: 3
Joined: 14. Sep 2021, 14:12
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Debian 10

Previous

Return to Windows Guests

Who is online

Users browsing this forum: No registered users and 26 guests