SOLVED: bizarre performance problem

Discussions related to using VirtualBox on Linux hosts.

SOLVED: bizarre performance problem

Postby nighttimestereo » 24. Oct 2008, 04:19


Host system:
Lenovo Thinkpad T61p with Core 2 Duo and 4GB ram
Ubuntu 8.04.1 AMD64
Virtualbox 1.5.6_OSE

Guest system:
Base Memory Size: 512MB
Video Memory Size: 32MB
Adapter Type: PCnet-FAST III (Am79C973)
Attached to: NAT
The problem happens with hardware virtualization on or off.
Windows XP SP2

Here is the problem:
I use this VM to run a single application for one of my jobs. Everything starts normally and seems to run fine. However, after a period of time, the following all occur at once.

1. Virtualbox's CPU usage on the host climbs to 99%.
2. The system clock inside Windows XP slows down. It is as if the whole guest machine is operating in slow motion. Windows take longer to maximize and minimize.
3. The task manager inside Windows XP shows that CPU usage flutters around 10% to 30% with all of it spent in the kernel. (i.e. the red line on the graph is a hair's breadth below the green line).

After a while (30 seconds to 1 minute), the following all occur in sequence.

4. The task manager inside Windows XP shows that CPU usage drops to nearly nothing.
5. The system clock inside Windows XP speeds up to faster than normal. About 2-4 virtual seconds go by for every real second that goes by.
6. This goes on for roughly 10 to 20 seconds.
7a. The system clock inside Windows XP returns to normal speed and Virtualbox's CPU usage on the host returns to normal. After a couple of minutes, GOTO 1.
7b. GOTO 1.

Whether we reach step 7a or 7b from 6 seems to depend on how long I've been using the virtual machine.

My Attempts At A Solution

Whenever I am running the custom app I am interacting with customers paying truly horrendous rates for my time (no, I don't work in THAT industry). Consequently, I can't just ask them to hang around while I perform detailed tests on my setup.

However, I have managed to try a few things so far. Obviously I have searched the web, but I didn't find anything useful.

My gut instinct was that Windows XP was spending a lot of time swapping. That's a kernel mode operation, so it would explain the high kernel times and the amount of CPU time the Virtualbox process is using while emulating a CPU in ring 0. Due to the larger amount of RAM on the host, I wasn't seeing a flashing HDD light since the Virtualbox process would effectively be swapping between the 256MB of virtualized RAM and the host system's buffer cache for the virtual disk file (both in memory).

Also, my commit charge (200MB-300MB) was topping the amount of physical memory I had set the Windows XP VM to use (256MB). Bumping that up to 512MB of physical memory may have ameliorated the problem somewhat, but like I said: testing is difficult while I'm running the custom app.

It isn't totally unreasonable that Windows XP would still swap even when the commit charge fits in RAM, so I'm not convinced that the problem isn't swapping.

The next time I work, I'm going to try disabling the page file in Windows XP. That ought to put a stop to swapping once and for all. However, as this issue is disruping my ability to work, I'd appreciate some feedback even before I try the pagefile thing.

Questions For The Intelligent Virtualbox Community

1. Would excessive swapping inside the VM cause the symptoms that I describe on a host with plenty of RAM?
2. What else could it be?
3. How can I profile Virtualbox to find out what it's really doing with 99% of my CPU time?

I know this was a long post, so I appreciate you (yes, you!) taking the time to read it. Thanks!
Last edited by nighttimestereo on 18. Jan 2009, 01:07, edited 1 time in total.
Posts: 3
Joined: 24. Oct 2008, 03:36

Postby vkov_tinsky » 24. Oct 2008, 04:41

The task manager inside Windows XP shows that CPU usage flutters around 10% to 30% with all of it spent in the kernel.

Maybe I'm talking rubbish but is it possible to see in e.g. Process Explorer what thread it's spending most of the time on? Secondly regarding your swapping theory - I assume DiskMon would show this (since you're not doing anything else at the time.)

Posts: 218
Joined: 5. Apr 2008, 20:18

Postby nighttimestereo » 24. Oct 2008, 06:26

Wow! Thanks for responding so quickly. I'm going to get my guest all set up with Process Explorer and Diskmon. Thanks! :)
Posts: 3
Joined: 24. Oct 2008, 03:36

bizzarre performance problem - workaround?

Postby Alegranon » 7. Nov 2008, 21:10

I have a similar problem. A possible answer to your question about what else it could be: it might be the Hyperthreading capability of the CPU in the host computer. If the host machine has Hyperthreading "enabled" in the BIOS, change it to "disabled". This fixed the clock issue on a Pentium 4 machine with Windows XP SP3 that has VBox 2.0.2 installed with a Linux guest booting from the Knoppix 5.3.1 Live DVD iso image. After this change, the system clock in the Linux guest now increments at the same interval as the Windows host's clock.
Posts: 3
Joined: 7. Nov 2008, 20:50

SOLVED: bizarre performance problem

Postby nighttimestereo » 18. Jan 2009, 01:06

Just dropping a note to tell everyone the solution. I increased the VM's memory to 768MB and turned off the pagefile in Windows XP. No more performance problems. :)
Posts: 3
Joined: 24. Oct 2008, 03:36

Return to VirtualBox on Linux Hosts

Who is online

Users browsing this forum: No registered users and 30 guests