Ubuntu 18.04 on windows 10 CPU usage

Discussions related to using VirtualBox on Windows hosts.
Post Reply
ysimhony
Posts: 6
Joined: 3. Oct 2017, 18:53

Ubuntu 18.04 on windows 10 CPU usage

Post by ysimhony »

Hello there,

I am helpless with this issue, and could not find any solution to resolve my problem.

I am using windows10 Home with 8GB RAM, x64 bit architechture.
I am using VBOX version 6.1.3.

On which, I am trying to have guest OS of Ubuntu 18.04 (x64bit) with the following:
Single processor
4GB RAM
128MB Video Memory

I observed degrdation in CPU of the Host machine running the VM process.

So, while the VM is idle (i.e. no real activity on the VM machine) the CPU usage in the host machine(Windows) is about 1-3%.

When trying to interact with the VM, even in the simple operation of sliding the Ubuntu lock screen in order to type the login password, result in huge leap in CPU usage of about 30%-40%.

I've been looking for many forums out there to find a solution, neither of them help.

Here is a short list:
1. Install Guest OS additions.
2. Both enable and disable 3D acceleration
3. Switch to 2 processors, instead of 1 (This result in even more CPU usage)
4. Enable "Use host I/O Cache" for the stroage controller

Here are some snapshots:
CPU usage when VM is idle:
CPU usage when VM is idle:
cpu_on_idle.png (76.13 KiB) Viewed 3728 times
CPU usage after sliding the lock screen:
CPU usage after sliding the lock screen:
cpu_on_slide.png (79.6 KiB) Viewed 3728 times
CPU usage when build the linux kernel with make command
CPU usage when build the linux kernel with make command
cpu_on_make.png (76.48 KiB) Viewed 3728 times

Does it make sense to have such a huge leap in CPU usage (x10) when invoking simple commands as sliding the lock screen or calling make command?
Is this a known limitation of VBOX for Ubuntu guest OS, or is there anything that can be done?

For me, providing half of the host RAM for the guest OS should be enough in order to let it work properly.

I read that there might be some issues related to the Ubutnu Unity graphic interface, which I am not sure I fully understand. However, if that was the case then why would I have degradation for "make" command which does not perform any major graphic operation?


Thanks in advanced,

Yacov
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: Ubuntu 18.04 on windows 10 CPU usage

Post by mpack »

Please provide a VM log file. Make sure the VM is fully shut down, then right click it in the manager UI. Select "Show Log" and save "VBox.log" (no other file) to a zip file. Attach the zip here.

Before I see the actual evidence, I'm going to guess that 4GB RAM is too much for your host. Running 64bit Windows on an 8GB host, I find it very unlikely that you have 4GB RAM unused and available to be assigned to a VM.
ysimhony
Posts: 6
Joined: 3. Oct 2017, 18:53

Re: Ubuntu 18.04 on windows 10 CPU usage

Post by ysimhony »

Hi,

Thanks for your response.

Attached the VBox.log file
Ubuntu-Host-2021-12-29-09-43-48.zip
(32.52 KiB) Downloaded 4 times
Thanks,
Yacov
fth0
Volunteer
Posts: 5690
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: Ubuntu 18.04 on windows 10 CPU usage

Post by fth0 »

You've disabled System > Acceleration > Nested Paging (EPT/SLAT), which considerably slows down any VM. Additionally, I'd suggest to provide 2 vCPUs and 2 GB RAM to the VM, because your host is tight on memory.
ysimhony
Posts: 6
Joined: 3. Oct 2017, 18:53

Re: Ubuntu 18.04 on windows 10 CPU usage

Post by ysimhony »

Hi,

I enabled "Nested Paging", as well as setting2GM to VM.

However, still I see the CPU usage for the VM process keeps boiling.

when using 2CPUs it reached about 50%-60%.
Ubuntu-Host-2021-12-29-23-30-37-2cpu.zip
(33.74 KiB) Downloaded 4 times
While using 1CPU, it reached the same level of ~30%.
Ubuntu-Host-2021-12-29-23-09-22-1cpu.zip
(32.34 KiB) Downloaded 3 times
Am I missing something?

Thanks.
fth0
Volunteer
Posts: 5690
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: Ubuntu 18.04 on windows 10 CPU usage

Post by fth0 »

The Ubuntu-Host-2021-12-29-23-30-37-2cpu.log file doesn't show any issues (to me). Perhaps a VBoxHardening.log file can tell us more. Do you have any so-called security software running on your Windows host? Or a special file system (e.g. btrfs) in the Linux guest? Can you elaborate a bit more when you notice which CPU load?
ysimhony
Posts: 6
Joined: 3. Oct 2017, 18:53

Re: Ubuntu 18.04 on windows 10 CPU usage

Post by ysimhony »

Hi,

>Perhaps a VBoxHardening.log file can tell us more.
Attached
Ubuntu-Host-2021-12-31-10-41-02.zip
(22.63 KiB) Downloaded 6 times

>Do you have any so-called security software running on your Windows host?
Not sure how exactly to check it. But, even if so, why would it affect the process running the VM...

>Or a special file system (e.g. btrfs) in the Linux guest?
Again, I am not sure. But if I understand correctly this is supported starting from Ubuntu 20, while I am using Ubuntu 18.

>Can you elaborate a bit more when you notice which CPU load?
What do you mean exactly? This was from the initial begining when I installed the VM about 2 weeks ago.
I was working on a real machine with Ubuntu, and now I thoguht it might be more coveneient to use VM to build the linux kernel.

Maybe my expectation is not realistic, and CPU usage of 30%-50% on the host machine for running the VM machine, while the VM machine is not idle, should be ok. I don't know.
I was trying to compare the CPU usage of the Windows host machine and the CPU usage of the guest machine side by side - opening the task manager in the host machine and running "top" command in the guest machine.
I can see that the cc1 command (which is the C compiler of the C source I assume) is the most consuming process with some hikes along the way ( I assume this is relevant to the inovocation of the cc1 command for each C source code file)
However, while there are hikes in the CPU usage in the guest machine becuase of the cc1 command, the CPU usage of the VM machine in the host machine is ~30% - no matter what.

Thanks,
Yacov

Thanks,
Yacov
fth0
Volunteer
Posts: 5690
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: Ubuntu 18.04 on windows 10 CPU usage

Post by fth0 »

Thanks for the Ubuntu-Host-2021-12-31-10-41-02.log file, which looks clean to me. No indications of so-called security software or other issues, some of which are known to slow down a VM, for example by scanning the virtual hard disk image all the time.

Some file systems (e.g. btrfs) are known to do some reorganization steps from time to time, stalling any disk access in the meantime.

Regarding CPU load, your expectations may be not realistic indeed. For example, when compiling source code, I'd expect a CPU load of 100% inside the guest OS, when doing it right (in parallel, that is). On the host, this could be similar to whatever percentage of the available CPU cores are provided to the VM; if you provide 1 of 2 CPU cores to the VM, it could be 30% - 50%.

In contrast to that, a VM can be about 90% as efficient as the host, meaning that a compilation running inside the guest can take roughly 10% more time than the same compilation running on the host.

When the guest OS is really idle (< 5%), 30% on the host would be quite much ...
Post Reply