High CPU use with idle guest (OS X host)

Discussions related to using VirtualBox on Mac OS X hosts.
Post Reply
Weylin
Posts: 8
Joined: 4. Dec 2017, 08:09
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win10, MS DOS

High CPU use with idle guest (OS X host)

Post by Weylin »

I seem to have a similar issue. I've attached a log file, I'll attached a screenshot in a min (as soon as I figure out the user interface to do it... even at lowest resolution I'm still above the attachment size limit). I also tried setting my VRAM lower - 256MB normally, I tried 128 which was the lowest I could cleanly set. As expected, that raised host CPU utilization by somewhere around 5-20%.
weylin
Attachments
Win10-2018-01-14-23-17-58.log.zip
(31.64 KiB) Downloaded 190 times
Weylin
Posts: 8
Joined: 4. Dec 2017, 08:09
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win10, MS DOS

Re: High CPU use with idle guest (OS X host)

Post by Weylin »

Guest CPU Load: 1%
Host CPU load used by the VirtualBox process: 47.6%

I had take the PNG screenshot, convert it to a JPEG-2000 file, and then finally zip it to get the screenshot below the size limit for an attachment and have an allowed extension.

weylin

[Mod edit; removed unnecessary attachment; be more "green"]
There is absolutely no point in attaching a) something that can be described with two words, b) something that is not readable by most people. PNG is already compressed, you don't need to ZIP it. What you should have done is to decrease the DPI to 72 from the HiDPI of 144 (using the Preview.app), and crop the image to a smaller ROI (Region Of Interest), not the whole desktop.
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: High CPU use with idle guest (OS X host)

Post by mpack »

First, you originally posted this to a topic with a similar name in the Windows Hosts forum. You have an OS X host. Please try to pay attention to your forum choice.

In the meantime I created a new topic for you in the "OSX Hosts" forum and copied your posts there.

Second, the image you provided is not readable by any reader I have here (Win10 image viewer, Paint Shop Pro, GIMP). All of them say that the image is junk. Any decent graphics package should allow you to paste in a screenshot, crop it to only the relevant portion, shrink the resolution if need be, and save as a PNG. I would not suggest exporting to JPEG2000, since that format never IMO gained the widespread acceptance of baseline JPEG. PNG is the best choice if you want to retain detail in screenshots, and you want everyone to be able to view the image.

Finally, you have not said much about the context. What is the guest doing at the time? If the guest is doing a lot of I/O, e.g. using simulated DMA, then it's normal for this to appear as a high CPU load on the host. Naturally it doesn't appear as CPU load in the guest since the guest isn't doing the work.

One thing I can tell you is that you have overcommitted CPU (all cores allocated to guest, leaving none for host), so of course you're going to have problems if the host needs to do work.
00:00:01.614608 NumCPUs <integer> = 0x0000000000000004 (4) { cores allocated to guest }
...
00:00:01.953478 CPUM: Logical host processors: 8 present, 8 max, 8 online, online mask: 00000000000000ff
00:00:01.953483 CPUM: Physical host cores: 4
Weylin
Posts: 8
Joined: 4. Dec 2017, 08:09
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win10, MS DOS

Re: High CPU use with idle guest (OS X host)

Post by Weylin »

Thanks mpack for the correction. I replied to a post on a similar topic; my apologies for the mistake.

If desired, I can re-capture relevant screenshots, but all they were showing anyway is that the Guest was reporting 1% load (of a max of 400%) while the host was reporting 46% load at the time (of a max of 800%).

As to to context - windows was network-idle. i've even detached all networking (different scenarios), and seen the same symptoms. There was also zero disk activity. There were no programs loaded, as I had performed a "clean" start to minimize whatever I could. The only guest process that I can tell was using any CPU was the activity monitor (or whatever Windows calls it... "task manager?").

I've set the number of CPUs down as low as 2, and the symptoms persisted. With 2 CPUs allocated to guest, I noticed no benefit to host performance when under load, but a definite detriment to guest performance under load. The settings allow me to select up to 8, I've tried that before and had REAL issues (required power cycling the host to fix), but I've gone as high as 7 and still been able to at least use the host (though it didn't perform well). I ultimately tried varying the number of CPUs among all values between 2 (MS's minimum) and 8; the result of my performance profiling suggested 4 was the ideal point for my setup.

I've done similar profiling on System RAM and graphics RAM allocation, and have settled on my current values as their ideals.

In none of my profiling tests did the Virtual Box application use less than around 40% CPU (average) of total 800% host CPU resources (I've actually seen macOS Activity monitor report 800% on many occasions... not a fault of VirtualBox, but rather for some heavy multi-tasking I was doing at those times).
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: High CPU use with idle guest (OS X host)

Post by mpack »

Weylin wrote: the result of my performance profiling suggested 4 was the ideal point for my setup.
A one off performance profile really isn't very useful, unless you can be sure that the host and guest loads are static. If the host needs to do work to service the guest, but the guest has been assigned all the available CPU then there's going to be trouble, take my word for it. I'd suggest that your default config should be to allocate two cores to a VM, no less and no more. That's plenty for most guests, and leaves the host with enough to handle all loads.

Beyond that, if there is high CPU use then the guest can't be idle. CPU time is like energy. It can get converted into work, but it can't just disappear. So if CPU use is high then it's because code is running. You need to work out what that might be, bearing in mind that simulating hardware will require host CPU time, but it should be straightforward to work out what the CPU time is being spent on, e.g. networking, software rendering of graphics etc, simulation of audio chipset etc. By turning off some of these features it should be possible to pinpoint which has the greatest effect.
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: High CPU use with idle guest (OS X host)

Post by socratis »

@Weylin
Just to clear up one thing; you do have 4 CPUs, 8 threads. See Intel's entry for your i7-4750HQ (read the help popup under the "?"). Since VirtualBox cares only about physical cores, you have 4 available CPUS, you should give no more than 3 to your guest, if you really, really need them. Otherwise stick to 2, just like mpack suggested...
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
Weylin
Posts: 8
Joined: 4. Dec 2017, 08:09
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win10, MS DOS

Re: High CPU use with idle guest (OS X host)

Post by Weylin »

I've been following HyperThreading technology since late 90's when Intel first released it; I'm familiar with the theory. When I profile systems, it's at various levels and settings, for extended durations (well... at least a few days each anyway). I then re-perform this around once a year or so. I've consistently (across OS versions and hardware refresh cycles) found "4" to be the "sweet spot" number of CPUs to balance guest and host performance. So while I understand the theory and the argument, the performance I've experienced doesn't line up against it. It's always confused me, but I've never really evaluated the theoretical underpinning to what I'm seeing.

(Yes, I'm basically quoting you in the next paragraph... writing this out is an exercise for me toward learning it for myself; apologies if that's coming across negatively, it's not my intent.)

In any event, thinking through the comments that have been made on this topic, I've come to understand... or at least, I've come to something that at least makes sense in my head. There are various acceleration features that a guest assumes that VirtualBox needs to simulate; you mentioned DMA as an example, I have to believe graphics acceleration is potentially another example. If the guest is highly hardware-optimized, then that would show on the host as increased utilization, especially if the system loads take a lot of use of those accelerations. Additionally, I've found that macOS, and Windows, and Linux, and... all report system utilization differently, making the comparison quite difficult, and for-sure no "apples to apples."

In any event, I think you've helped me understand the difference in measurements I've experienced, so thank you for that.
Post Reply