Make Windows Almost 50% Faster Under VirtualBox 2
I’ve been slightly disappointed with overall VirtualBox performance and decided to see what I could do to make things faster. For me, there are 3 elements to the performance issue. CPU, Disk and Network I/O. At this point, I only have possible solutions for two of the three areas.
My server is running Ubuntu Server x64 10.04 with VirtualBox 3.1.6 OSE directly from the Ubuntu repository. Below, I’ll describe how to improve both disk and network I/O performance. I think these suggestions will apply to other versions and MS-Windows hosts too.
Disk I/O
By default, VirtualBox will use an IDE disk interface. IDE drives are dumb and not the newest technology. Newer isn’t always better, but in this case, it is. I followed some instructions for how to swap the IDE drive controller for a SATA drive controller in VirtualBox.
Swapping the controller for Linux clients was trivial. Just add a new disk controller in the vbox “Storage” and connect your old VDI file to the SATA controller. Then remove the IDE controller from the settings. Done.
In MS-WindowsXP, it wasn’t as easy. I first added the new SATA controller and a dummy 6MB VDI file. Then booted WinXP. The OS saw the new hardware, but didn’t know what to do. The needed driver could not be installed automatically. A little google work and about 5 failed links before a working link to Intel SATA drivers was found, downloaded and installed. The dummy drive was immediately seen and waiting to be formatted. Shutdown the VM. Go back into the VM settings, move the old winxp.vdi from the IDE controller to the SATA controller. Remove the dummy .VDI file and boot. I left the CDROM drive connected with IDE.
At this point, with a working SATA controller, I decided to perform a quick timing test to see whether this was worth it or not. I didn’t try to do anything too exacting since that would require reboots of the host between tests. My host machine has other work to do and it will while running the VMs too. For me, this was just a did I make it worse question. I let the host system calm down, synced the disks and performed a WinXP boot time test. I used ‘time’ to get a wall clock time. The other data wasn’t useful since it didn’t actually “time” the VM.
To further improve disk I/O, install the VM image files on a different physical disk than the hostOS runs or, even better, install a disk array that stripes the data across at least 4 drives. Other articles here on RAID systems.
WinXP Boot Time under VirtualBox
- IDE 0m27.380s
- SATA 0m18.882s
To me, those statistics speak for themselves even if my testing method was less than perfect. Another bonus – there was no request to re-activate MS-Windows for this disk controller change. Odd.
Network I/O
By default, VirtualBox will use an AMD 10/100base-tx network interface. VirtualBox supports using an Intel PRO/1000 MT 1000base-tx NIC regardless of the physical devices inside your machine. I have dual 1000base-tx network adapters in most of my machines. I tried to use the default driver inside the VM and found it was slow – limited to about 70Mbps. Reasonable for a 10/100 NIC. My network is GigE and I use remote networked file systems a bunch.
Swapping the network controller for Linux clients was trivial. Just add the new NIC controller in the vbox settings under the Network _Advanced" settings. Modern Linux distributions come with the Intel PRO/1000 MT driver. Done and done. Simple. You may find that your distro adds another ethernet device – eth2, eth3 … etc rather than reusing the eth0. You can fix that in the /etc/udev/devices directory.
In MS-WindowsXP, it wasn’t as easy. I first added a new Intel PRO/1000 network controller as a secondary NIC. Then booted the VM and saw that again, WinXP doesn’t have the drivers and couldn’t find them. Again out to the Intel driver download website. I gotta wonder why Intel uses javascript, but at least this time they didn’t force me to use IE to download like they do with the HDMI drivers (long story). Found the driver, downloaded, installed. Shutdown the VM. Back in the vbox network settings, I change the 10/100 NIC to the Intel PRO/1000 MT and remove the dummy NIC. Testing a connection to my samba server and 650MBps is seen. Excellent.
Another bonus – there was no request to re-activate MS-Windows for this network controller change. Odd.
Why did I select the Intel PRO/1000 MT adapter? It is well known in IT servers that not all GigE NICs are created equal. If you are an IT server administrator, you know that Intel NICs provide the best performance for your cost and are the standard. Why use the MT version instead of the server version? I’m running desktops here. I don’t want to worry that only server drivers are available when I have WinXP-Home as the OS.
Other Suggestions
Client VM RAM
For any VM to have the best performance, we know to give it enough RAM. Enough is as much as you can spare that makes the specific OS happy. For WinXP, I think that number is 1GB.
Client VM CPUs
If the OS supports multiple CPUs, then you should install it with 2 CPUs (or more) available. WinXP will install with either 1 or 2 CPU support in the HAL. If you install with 1 CPU/Core, then you are basically stuck with 1 CPU until a reinstall. That isn’t really true, but the steps to enable a second CPU is non-trivial. Reinstalling the OS is much easier.
Summary
By changing to SATA and GigE controllers in your VirtualBox client VMs, you’ll see better performance and probably lower host CPU utilization.
I understand that SATA drivers are included with Windows Vista and Windows7. I’m not certain about the GigE drivers.
Next, I’d like to find a way to get VBox to use 100% of a core. So far, I’ve only seen about 50% of a core used by a client.
What have you found that will improve your virtual client performance?
Trackbacks
Use the following link to trackback from your own site:
https://blog.jdpfu.com/trackbacks?article_id=671
Ok, so virtio seems to be the answer for even better performance under virtualization. I’d prefer to use KVM instead of VirtualBox, but when I was testing KVM, the performance was really, really bad.
Sorry for the cross post, but here’s the best link to virtio drivers for KVM that I’ve found.
Many of these choices are automatic in VirtualBox now. Although I wouldn’t expect SATA to be the default disk device on older client OS, so you will probably need to manually get the drivers – it is worth it.
Obviously, SATA drivers for WinME aren’t gonna happen, so don’t bother trying. We’re stuck with IDE.