Virtualbox VM Super Slow

Discussions related to using VirtualBox on Windows hosts.
TS1997
Posts: 8
Joined: 12. May 2021, 16:17

Virtualbox VM Super Slow

Post by TS1997 »

Hello!

I'm a web developer and am currently using a VirtualBox VM with Ubuntu 20.04 64-bit as my "work computer" while working from home but I've never managed to make it run fluently. The problem is that it's always running super slow and is laggy even if I don't have any apps running.

The host machine is running an Intel i7-8700k, 32GB RAM and an ASUS GTX 1080Ti. I've tried a bunch of different VM settings where I've given the VM everything from 1-6 CPU cores, a CPU execution cap of 50-100%, 4-24GB RAM, 128-256MB VRAM and with 3D acceleration enabled and disabled. I've also tried having the VMs virtual disk on a Western Digital Gold HDD and a Samsung 860 EVO SSD. I've also tried both VDI and VMDK as the virtual disk file format. I've also tried two different VirtualBox versions but both are 6.X and I've made sure that the guest additions are for the correct VirtualBox version on both.

I've also tried multiple new VMs so it isn't a specific VM that's giving me trouble but rather any VM including fresh ones. I've also noticed that 3D acceleration makes the VM slower than without which I feel is weird based on the host specs. I've also tried Ubuntu 18.04 with the same results as well as the host on Windows 10 Pro 1809, 1909 and 20H2 but the issue persists across all these. I can also mention that Hyper-V is completely disabled and I'm not running anything in the background on the host while using the VM.

Another thing I've had happen a couple of times is that the VM completely freezes to the point where I have to shut VirtualBox down completely. I've never been able to start the VM again after this has happened, it gets to a black screen, sometimes the purple Ubuntu color screen, but never all the way booted up and I did leave it over night once. It did manage to boot up once though but then it was completely frozen at the desktop instead so it was still unusable. It doesn't seem to be a corrupt virtual disk though as I was able to install VMWare Player, create a new VM and use the old VirtualBox VMs virtual disk (one with VMDK) and it booted. Something were still off though as it was unusably slow there as well, I just managed to recover important files that way.

I've added the log files of one of the VMs that won't boot here in the hopes that it might be of help. If anything else is needed just let me know!

Any tips, tricks, suggestions etc are greatly appreciated!

Thanks in advance!
Attachments
VM Logs.zip
(60.79 KiB) Downloaded 13 times
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Virtualbox VM Super Slow

Post by mpack »

We need a log that hasn't been corrupted by being copied out while VirtualBox was still running.

We don't need the hardening log at all unless you have a hardening problem, i.e. unless the exit code at the end of the hardening log is something other than 0. Unfortunately this can't be established using the partial log you provided.

The usual reason for "super slow" is having Hyper-v enabled. See HMR3Init: Attempting fall back to NEM (Hyper-V is active).
TS1997
Posts: 8
Joined: 12. May 2021, 16:17

Re: Virtualbox VM Super Slow

Post by TS1997 »

How would I go about retrieving a log without copying a corrupted one since it won't get to a state that allows me to shut it down properly? Or isn't that possible so I should get a log from one that's just slow but hasn't crashed yet?
scottgus1
Site Moderator
Posts: 20965
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: Virtualbox VM Super Slow

Post by scottgus1 »

If you cannot shut down the VM within the VM's OS, then close the Virtualbox window for the VM with the Power Off option set. That will let the Virtualbox log close off correctly.

The posted log shows no Hyper-V problems:
00:00:02.850770 HM: HMR3Init: VT-x w/ nested paging and unrestricted guest execution hw support


However the CPU count is high:
Host CPU status:
00:00:03.795051 CPUM: Logical host processors: 12 present, 12 max, 12 online, online mask: 0000000000000fff
00:00:03.795052 CPUM: Physical host cores: 6
00:00:03.795252 Full Name: "Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz"
Guest CPU settings:
00:00:02.850339 NumCPUs <integer> = 0x0000000000000008 (8)
While folks running compilers report better compiling when there's more "processors" in the VM than there are on the host (only physical processors count, not the hyperthreads), most users report more sluggishness with more "processors". This is because each "processor" is a thread on the host, which all have to be scheduled, which slows things down.

Try reducing processor count to 2, let the VM reboot a couple times, then try from a fresh shut-down and start. Zip and post that log after shutting down the VM, if it is still not performing properly.
TS1997
Posts: 8
Joined: 12. May 2021, 16:17

Re: Virtualbox VM Super Slow

Post by TS1997 »

I tried doing this and since I "downgraded" to 2 cores it started but as soon as I try starting anything it hangs completely so I had to power it off by closing the VirtualBox window. I've attached a new log in this post and this log is the 4th attempt after reducing the core count
Attachments
vbox.zip
New log after reducing core count
(38.29 KiB) Downloaded 11 times
scottgus1
Site Moderator
Posts: 20965
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: Virtualbox VM Super Slow

Post by scottgus1 »

Only one thing I saw that might be odd: the VM is booting with EFI BIOS, not legacy BIOS. The default for an Ubuntu VM is legacy BIOS. Did you change this to EFI for a reason?

Please make a new VM, leaving all the defaults that Virtualbox picks, except for 2 processors and regular/video RAM. Install the same Ubuntu ISO, see what happens.
TS1997
Posts: 8
Joined: 12. May 2021, 16:17

Re: Virtualbox VM Super Slow

Post by TS1997 »

I've looked at a bunch of guides on how to set things up properly since it hasn't worked for me so I probably changed it because of some guide.

Is there a limit to how much RAM I should assign in the same way that the processors only should be 2 even though the host has a lot more?
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Virtualbox VM Super Slow

Post by mpack »

TS1997 wrote:Is there a limit to how much RAM I should assign in the same way that the processors only should be 2?
Not really. But, basically you should try for fair sharing between host and guest. In order for the host OS to run well it needs plenty of CPU and RAM. VirtualBox runs on the host OS, so this matters. You can't give all your resources to the VM and expect it to run well.

There is a separate reason why allocating too many cores to a VM makes it run slower. Basically if the VM isn't really using those cores then the cost of managing them is the only thing they add, and it's a negative effect. Most users are actually, really using around two cores at a time - they just don't tend to be doing lots of heavy CPU stuff in parallel.

I had already noticed that you assigned the VM 20GB RAM with only 24GB RAM available (from 32GB installed). This is probably ok, but it's not a fair division. Personally I would have used 2 cores and 8GB RAM, unless there is a solid reason why the VM must have more.

Other than that... I see you are running from drive F. What is drive F? If it's a USB or network drive then this probably causes poor disk performance, especially if your expectations are based on locally attached SSDs.

Your graphics config looks ok. I have seen poor performance from Ubuntu recently, but I don't have the Linux expertise to be sure of why. I suspect the desktop environment is not very efficient, because I get no such problems e.g. with Manjaro running XFCE.

The following won't cause slow performance, but it's good practice to eject the Guest Additions ISO after use. That way it isn't mounted in any VM the next time you upgrade.
TS1997
Posts: 8
Joined: 12. May 2021, 16:17

Re: Virtualbox VM Super Slow

Post by TS1997 »

Thanks for those details! I'll start with 2 cores and 8GB of RAM to see how that goes and increase to 16GB if it seems too low for what I do. Drive F is a Western Digital Gold 8TB drive installed locally on the host machine as I've accumulated quite a few drives over the years with C being a NVMe SSD and D & E being SATA SSDs.

One thing I have to do sometimes during work is running docker instances, are there any settings I should change in order for that to work properly?
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Virtualbox VM Super Slow

Post by mpack »

I've never used Docker, but I would expect it to cause problems since I believe it will cause Hyper-v to be enabled, which will conflict with VirtualBox. If you can arrange to have this happen only temporarily, that would help.
RodrigoLemeNunes
Posts: 1
Joined: 20. May 2021, 17:05

Re: Virtualbox VM Super Slow

Post by RodrigoLemeNunes »

I may not be sure but it looks like the cpu steal time on linux ( top / vmstat ) is not reported correctly when the "Execution Cap" feature is used.
TS1997
Posts: 8
Joined: 12. May 2021, 16:17

Re: Virtualbox VM Super Slow

Post by TS1997 »

I've now been running a new VM for a few days with the settings you guys suggested and it worked fine until today when it completely froze again. I've attached a new log from this machine. It did start up fine again this time though which the other machines didn't do
Attachments
VM.zip
(33.85 KiB) Downloaded 7 times
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Virtualbox VM Super Slow

Post by mpack »

You say "it completely froze again". What do you mean by "it"?

I don't see any sign of a VM hang (the VM in fact continues to completion) or even a guest OS hang: the log would usually contain an indication if the "heartbeat" stopped being received for some number of seconds (2 seconds according to the latest log).

I don't think you have a hang, I think you have something in the guest hogging the CPU, or possibly hogging I/O bandwidth. Perhaps the Ubuntu process list would tell you. Do you maybe have a backup task set up to run automatically?
TS1997
Posts: 8
Joined: 12. May 2021, 16:17

Re: Virtualbox VM Super Slow

Post by TS1997 »

What I mean by completely froze is that I couldn't do anything at all and had to shut it down completely by closing the VM window as I couldn't press shut down through the OS. I did let it be for about 10 minutes between the time it froze and when I shut it down in case it were just working on something. I don't have any automatic backup tasks nor any other programs running on the host except for Spotify. I've tried accessing the Ubuntu task list before but that isn't possible as it's completely unresponsive. I even let one of the older VMs stay on over night and it were still frozen by the next morning. I did check Windows Task Manager on the host though and it were below 20% on all components (CPU, RAM, SSD etc).

I'm not sure weather I'm having a VirtualBox or Ubuntu issue as the root of the issue, all I know is that the machine becomes completely unresponsive to the point where I can't access anything for troubleshooting except for the VirtualBox logs.
scottgus1
Site Moderator
Posts: 20965
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: Virtualbox VM Super Slow

Post by scottgus1 »

There's a lot of screen-size flip-floppery going on, and 3D acceleration is enabled. Were you changing or maneuvering the screens of the VM before this VM seized?

The original log also had 3D acceleration enabled. Please try disabling it, see what happens.
Post Reply