Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I run a guest ubuntu 12.04 on a host ubuntu 12.04, with VirtualBox, and the guest is much, much slower than the host (ALT+TAB takes 4-5 secs). I had a look around and I found contradicting opinions on VirtualBox versus VMware (free); so I thought to keep the former.

Both systems are updated, I installed the additions on the guest and I evenly split memory and video memory (64MB) between guest and host. I am running a Toshiba m200 laptop with 4GB ram and shared video memory. The host bios does not include a configuration option for machine virtualization. I have 2 cpus and I can't give them both to the virtual machine.

Is there anything I overlooked that could solve my problem?

Feel free to ask for more info, and thank you for any help.

EDIT Idling with the system monitor open the (single) guest cpu never gets below 55% and could rise to 80 - 90% just by moving the mouse around. Opening Firefox will cause the system monitor to show cpu usage 100% in the guest, while the host shows that both cpus are evenly working around 60%.

My cpu is Intel® Core™2 Duo CPU T5450 @ 1.66GHz × 2.

If this is not a configuration problem, does it mean my machine is too weak for virtualization?

share|improve this question
    
even installing unity2d (which helped) and trying different configuration the vm is still too slow for my taste, so I abandoned the idea by now –  ecoologic Sep 19 '12 at 11:09

4 Answers 4

up vote 6 down vote accepted

A virtual guest with that low of resources will run slowly. For best performance you actually give your host a bit more resources than the guest. Also you will not be able to give both cpu's to your virtual machine since your host machine needs something to run everything.

Think of it this way. Your host machine has to run its' own system plus the container for the guest. The guest gets into a resource fight with the host machine. Try giving the guest less and see how it runs.

For best performance you will want a 64 bit machine with more than 4gb of memory.

share|improve this answer
    
I actually tried several configurations before asking the community, ram shouldn't be a problem at this stage (the most of it is unused), from your answer I get that the problem should rely mainly on the cpu (often at 100%), I taught my laptop was powerful enough, maybe it's here I'm wrong... –  ecoologic Sep 18 '12 at 20:28
    
A thought may be to watch resource usage in both host and guest and see what is being exhausted where. What type of processor do you have? –  Nate Sep 18 '12 at 20:31
    
it's not the fastest machine you'll ever see, but it never disappointed me (answer updated). –  ecoologic Sep 18 '12 at 20:44
    
Yes I would say you machine is not powerful enough for speedy virtualization. You obviously have it running so it is up to you if you want to live with the speed. –  Nate Sep 18 '12 at 20:49
2  
@ecoologic: Unity2D runs much faster - did you try? –  Takkat Sep 18 '12 at 20:50

I don't know much about Player, but Vbox defaults are not good for Ubuntu releases that prefer a real GPU.

  • On spinning HDDs, pre-allocate the entire virtual disk. On SSDs, it doesn't matter.
  • Allocate only the storage you need. Keep large files elsewhere, outside the vStorage.
  • Never allocate more CPUs or RAM than you should. 1 vCPU is probably enough.
  • Leave 1GB of RAM for the HostOS. Do not over commit RAM.
  • Use the VirtIO drivers for Storage and Networking. Modern Linux guests support this. For Windows guests, use the SATA (storage) and Intel PRO/1000 (network) drivers. It is possible to use virtio drivers under Windows, it is just a little harder.
  • Enable ACPI and AHCI for all guests from 2003, WinXP and later.
  • Desktop VMs should get all 128MB of display vRAM
  • Server VMs should stay with 9MB of vRAM; don't waste it.
  • Avoid 2D and 3D accel settings, until you have everything else working the way you like. I'm serious. Ubuntu does bad things when this is enabled. It can bring a Core i7 to the ground.

For more details: http://blog.jdpfu.com/2012/09/14/solution-for-slow-ubuntu-in-virtualbox

share|improve this answer
    
+1 I can't test it right now but what you're writing makes a lot of sense. –  ecoologic Jan 9 '13 at 23:19

This solution worked for me.

I didn't have to reinstall the whole system again. I cloned my current machine (just in case) and set the configuration as the blog said and it does work. I don't think it is perfect but at least tolerable. The only thing I couldn't set is turn off the dynamic storage for a static one. Any ideas?

share|improve this answer
2  
You should add a small abstract of the answer (at least) located in the blog. –  user91091 Oct 29 '12 at 17:15
    
Also, if you have a separate question, post it as such please. It is unlikely to be answered otherwise, if not entirely ignored. Once done, edit your answer here to improve it. –  user98085 Oct 30 '12 at 23:38

In addition to the previous answers for optimal VirtualBox settings, there is a great blog post by Nam Huy on how to get 3D acceleration to work for an Ubuntu guest. This is especially useful for Ubuntu 13.04, as there is no option to install Unity 2D anymore, leaving a fresh installation without any real workload on 80-100% CPU load due to software rendering, making it practically useless for me.

The basic idea is to install guest additions, load "vboxvideo" into etc/modules, reboot, and then activate 3D acceleration in the VirtualBox Display settings. Note that enabling 3D acceleration has to be the very last step after configuring everything else in the guest.

For me, this brought a massive performance boost, in fullscreen mode I can't even tell the difference between my native OS and the Ubuntu guest.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.