Page 1 of 1

CPU utilization

Posted: 7. Jul 2009, 21:39
by j1mw3b
I previously posted on the high CPU utilization with VirtualBox.
I started using VBoxHeadless to start my WinXP vm and now my cpu is very low.
Very easy to start and stop the VMs anytime, including at bootup and shutdown - shutdown/stop does a savestate which makes it much faster to start and stop.

The only thing that is troubling me is I have one WinXP and one Centos5.3 VM. So I must either specify a different VRDP port on one of them or disable it.

If the VMs are DHCP, how can I easily (or not so easily) determine the IP address of the machines so I can either rdesktop or vnc to them? No problem to login to the VirtualBOx host machine to look around, but need to know where.
I guess one way is to use the shared folders feature and just echo the ip address to a file there.

Thanks,

Jim

Re: CPU utilization

Posted: 8. Jul 2009, 02:24
by Bintje
You brought new light upon my tries of getting VB to use less CPU. When I'm doing a download with Utorrent in my vm the CPU can go as high as 80-90% and I'm going insane from time to time. Not even the "two started vm's" works to get the CPU lower. So hopefully VBHeadless will do the trick... :|

Re: CPU utilization

Posted: 8. Jul 2009, 04:08
by j1mw3b
Just a thought......
A few days ago I switched from KDE to Gnome desktop - but never checked the CPU usage after doing that. Yesterday, I started using VBoxHeadless, not for the CPU, but so I could start/stoip at bootup/shutdown. It was only today I noticed the low CPU usage.

So... It could be the VBoxHeadless, and then again it could be Gnome... or then again, maybe like a new car engine, VBox has to be "run in" for a while before the CPU settles down :-)

Anyway, I'll try it again both ways tomorrow. Easy to switch between KDE and Gnome.

PS - don't do what I did and try to remove KDE after switching to Gnome. Really bad things happen.

Jim

Re: CPU utilization

Posted: 8. Jul 2009, 05:06
by Bintje
The reason bad things happen is because you shouldnt switch from KDE to Gnome! ;)

That wasnt the response I wanted! I wanted you to say "VBHeadless will fix all your problem with CPU" not "it could be that or that." :D I am still tempted to test VBHeadless when I get home from work. Looking forward to hear about how it went using either KDE or Gnome.

Re: CPU utilization

Posted: 9. Jul 2009, 00:17
by j1mw3b
Ummmm.... bad news.

The low CPU was on my computer at work. Can't try it there again until next week.
But tried it at home - different computer model, different Centos 5.3 installation as VM.
OpenSuSe 11.0 host at home vs 11.1 at work. Home has 3gb, work has 2gb memory.
Work
I also tried on my laptop which also has 11.1, but only Gnome.

i tried it all ways - headless and with Vbox GUI - with Gnome and with KDE.
All same results - high 90-100+ CPU.
I also tried on my laptop which also has 11.1, but only Gnome - same high CPU.
Laptop and work machine has kernel 2.6.27.23.

Very sorry - guess I posted too soon. Something on my work machine has changed however.
I wish I knew what. I really need to run WinXP on my home system.

Still worth a try for you however - little to lose.

BTW, I switched from KDE to Gnome 'cuz several times, my desktop, icons, etc have gone berserk on KDE. I tried to delete all of KDE, and switch to Gnome, but once you select KDe at install time, you are pretty much stuck with keeping it installed, even though you no longer logon with it. Will completely remove it when 11.2 is available for upgrade.

Jim

Re: CPU utilization

Posted: 9. Jul 2009, 02:55
by Bintje
Havnt tried VBHeadless yet(slept to long yesterday). Ok, so there will probably not be any differnece for me either then.

Checked today and realized it is just when the XP vm machine is active downloading torrents. I figured it may be beacuse you write to the maindisk through shared folders. Cause when you upload and no downloads are active it uses between 2-20% of CPU. ZoneAlarm makes it go skyhigh sometimes to thou, gonna try nod32 on it and see if it goes lower.

Re: CPU utilization

Posted: 9. Jul 2009, 03:45
by TerryE
j1mw3b wrote:If the VMs are DHCP, how can I easily (or not so easily) determine the IP address of the machines so I can either rdesktop or vnc to them? ... I guess one way is to use the shared folders feature and just echo the ip address to a file there.
No, use the guest VBoxControl utility to put the IP address in a guestproperty. You can then interrogate this from the host with a VBoxManage guestproperty command. Think of guest properties as system level shared environment variables.

Re: CPU utilization

Posted: 9. Jul 2009, 17:26
by j1mw3b
Terry, that's nice, but...
Doesn't it require that I first login to the guest VM (WinXP in this case) and then run the VBoxControl guestproperty.
However, I need the IP address in order to login to the guest.
What do I miss here?

Unless there is some method on the host to interrogate the guest VM's IP address, seems I need a WinXP service to issue the "ipconfig /all" command to get the IP addr; or a service to issue the VBoxControl thingy.
The shared memory way works quite nicely on the linux guests.

Jim

Re: CPU utilization

Posted: 9. Jul 2009, 18:50
by TerryE
j1mw3b wrote:Doesn't it require that I first login to the guest VM (WinXP in this case) and then run the VBoxControl guestproperty. However, I need the IP address in order to login to the guest. What do I miss here?
I forget that Wiindows makes it V difficult to do trivial stuff. What you need to do is to write a small WSH script to do this. First debug this at the command prompt. This mustn't write to stdout (in the final version but you can do when debugging it). Then register it with HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run and it will be run whenever you boot. Search the Internet for examples if you are unfamiliar with WSH. The alternative if you have difficulties is to autologon your XP and put this script in the startup folder.

Re: CPU utilization

Posted: 10. Jul 2009, 03:04
by j1mw3b
Yes, Windows does make things difficult. Glad I finally got rid of it on my laptop.
BTW, HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run starts a pgm at login, not at system boot.

I just wrote a little service pgm to echo ipconfig /all to a file on shared disk. Simple and adequate.

Re the CPU high usage. Seems like it is Centos only. XP is fine with the usage.
Guess it is something to do with the "divide=10" in grub that I see scattered on the net. Haven't gotten the syntax correct yet, but since I only use Centos at work and it's OK there, not gonna worry about it.
Work system is 2-cpu and apparently the Centos CPU doesn't bother it.

Thanks again,

Jim

Re: CPU utilization

Posted: 10. Jul 2009, 07:22
by fixedwheel
j1mw3b wrote:the "divide=10" in grub that I see scattered on the net. Haven't gotten the syntax correct yet,
:idea: Jim, you could look into your previous thread ... i already gave you two links to other threads where i posted syntax examples of editing divider=10 into /boot/grub/grub.conf :arrow: http://forums.virtualbox.org/viewtopic.php?t=18415

Re: CPU utilization

Posted: 10. Jul 2009, 23:23
by j1mw3b
Could have sworn I replied to this... anyway.
I actually did act on your previous post re those other threads. Tried the divider=10 and it had no effect at all. That is why I thought maybe I had a syntax error somehow.
Also why I tried the VBoxHeadless out of desperation.

I think I will try to download/install the Centos kernel optimized for VM.

FYI, my grub is this:
title CentOS (2.6.18-128.1.6.el5)
root (hd0,0)
kernel /boot/vmlinuz-2.6.18-128.1.6.el5 ro root=LABEL=/ rhgb quiet divider=10

And "uname -a" gives this:
Linux jcen 2.6.18-128.1.6.el5 #1 SMP Wed Apr 1 09:19:18 EDT 2009 i686 i686 i386 GNU/Linux

Actually, this is almost a non-problem since Centos runs OK at work and that's where I mostly require it. It was just baffling why VirtualBox was using such high CPU and then it got OK for some reason.

The work machine is a 2 cpu machine however so maybe it can keep up better with the Centos context switching.

Thanks,

Jim

Re: CPU utilization

Posted: 10. Jul 2009, 23:39
by fixedwheel
Tried the divider=10 and it had no effect at all.
hmm, starting with VBox 3.0 i got the well known "single guest running makes 100% load to one of the real CPU cores issue that can be worked around by simply starting a second -even dummy, paused- guest" VBox glitch on my debian host too :/

edit: VBox 3.0.2 ... this glitch is gone :) no host CPU load w/ one idle guest again