How do I improve the performance of my VirtualBox guest?

Solution 1:

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. VDI / qcow2 sparse allocations do reduce performance, but the reductions involved appear to be less than 10% since 2015. Weigh the performance vs convenience.
  • 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

Solution 2:

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.

Solution 3:

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.

Solution 4:

I have experienced the same problem

Host: Ubuntu 14.10 (64-bit), Guest: Windows 7 (64-bit)

Even with the virtualization turned on in host BIOS the CPU load was constantly around 40-50% in guest idle state

What helped me was installing Guest Addition with Direct 3D support (you need to do that in safe mode) and turning on the host I/O Cache of the SATA controller

So my current settings are:

System

Base memory: 4096 Mb (8192 Mb total host memory)

Processor: 6 CPUs (of host 6 CPUs)

PAE/NX: Enabled

VT-x/AMD-V: Enabled

Nested Paging: Enabled

Display

Video memory: 128 Mb

3D Acceleration: Enabled

2D Acceleration: Enabled

Works like a charm! Virtual Box Version: 4.3.18_Ubuntu r96516