SEARCH

How-To Geek

The HTG Guide To Speeding Up Your Virtual Machines

image

Virtual machines are demanding beasts, providing virtual hardware and running multiple operating systems on your computer at once. Upgrading your hardware (particularly your RAM and CPU) will always help speed up virtual machines, but there’s more you can do.

These tips will help you squeeze every last drop of performance out of your virtual machine, whether you’re using VirtualBox, VMware, Parallels, or any other virtual machine program.

Install VirtualBox Guest Additions or VMware Tools

After installing a guest operating system inside a virtual machine, he first thing you should do is install your virtual machine software’s drive package – Guest Additions for VirtualBox and VMware Tools for VMware. These packages include special drivers that help your guest operating system run faster on your virtual machine’s hardware.

Installing the package is simple – in VirtualBox, boot your guest operating system, click the Devices menu, and select Install Guest Additions. If you’re using VMware, select the Install VMware Tools option in the virtual machine’s menu instead. Follow the instructions on your screen to complete the installation – if you’re using a Windows guest operating system, it’ll be just like installing any other application.

image

Ensure you keep these updated with your virtual machine program – if you see a notification that an update is available for Guest Additions or VMware Tools, you should install it.

Create Fixed-Size Disks

When creating your virtual machine, you can create two different types of virtual disks. By default, virtual machine programs will generally use dynamically allocated disks that grow as you use them.

For example, if you create a new virtual machine with a dynamically allocated disk with a maximum size of 30 GB, it won’t take up 30 GB of space on your hard disk immediately – after installing your operating system and programs, it may only take up 10 GB. As you add more files to the virtual disk, it will expand up to its maximum size of 30 GB.

This can be convenient — each virtual machine won’t take up an unnecessarily large amount of space on your hard drive. However, it’s slower than creating a fixed-size disk (also known as a preallocated disk). When you create a fixed-size disk, all 30 GB of that space would be allocated immediately.

There’s a trade-off here – a fixed-size disk uses more space on your hard disk, but adding new files to the virtual machine’s hard disk is faster. You also won’t see as much file fragmentation – the space will be assigned in a large block instead of being added in smaller pieces.

image

Exclude Virtual Machine Directories In Your Antivirus

Your antivirus may be scanning your virtual machine files whenever they’re accessed, reducing performance. The antivirus can’t see inside the virtual machine to detect viruses running on your guest operating systems, so this scanning isn’t helpful.

To speed things up, you can add your virtual machine directory to your antivirus’s exclusions list. Once it’s on the list, your antivirus will ignore all files in this directory.

Read More: Antivirus Slowing Your PC Down? Maybe You Should Use Exclusions

image

Allocate More Memory

Virtual machines are memory hungry. Microsoft recommends 2 GB of RAM for 64-bit Windows 7 systems, and this recommendation also applies to Windows 7 when it’s running in a virtual machine. If you’re running memory-hungry applications in the virtual machine, you may even want to allocate more than 2 GB of RAM.

You can allocate more RAM in your virtual machine’s settings dialog (the virtual machine must be powered off to do this). If your computer doesn’t have enough RAM to comfortably run both the virtual machine and everything else on your computer, you’ll see degraded performance as your computer constantly uses the swap file on its hard drive.

image

Allocate More CPUs

If you have a computer with multiple CPUs, you may want to allocate additional CPUs to your virtual machine from its settings window. A virtul machine with a dual (or quad) core processor will be more responsive, just as a computer with more cores is.

image

Tweak Your Video Settings

Tweaking video settings and allocating a larger amount of video memory can also improve your virtual machine’s apparent speed. For example, enabling the 2D acceleration feature in VirtualBox improves video playback in virtual machines, while enabling 3D acceleration will allow you to use some 3D applications at a more reasonable speed.

Read More: How To Enable 3D Acceleration and Use Windows Aero in VirtualBox

image

Ensure Intel VT-x or AMD-V Is Enabled

Intel VT-x and AMD-V are special processor extensions that improve virtualization. Newer Intel and AMD processors generally include these features. However, some computers don’t automatically enable VT-x or AMD-V – you may have to go into your computer’s BIOS and enable this setting yourself, even if your computer supports it.

To determine whether your Intel CPU supports Intel VT, you can use Intel’s Processor Identification Utility. If your CPU supports this feature but the option is unavailable in your virtual machine program, you’ll need to enter your computer’s BIOS and enable this feature. This setting is generally enabled by default with AMD processors.

image

Place The Virtual Machine’s Files On Another Drive

Disk performance can limit your virtual machine’s speed. Placing the virtual machine’s files on a separate drive – not your system drive – can help improve performance. Your virtual machine and host operating system won’t be competing to read and write from the same disk.

However, you shouldn’t run the virtual machine off an external drive – this will be much slower.

image

Resume Instead of Shutting Down

When you’re done using your virtual machine, you may want to save its state instead of shutting it down completely. The next time you want to use your virtual machine, you can just double-click it to start it – the guest operating system will resume where you left off instead of booting up from scratch.

This is similar to using the hibernate or suspend feature instead of shutting your computer off. Your virtual machine program saves the contents of your virtual machine’s memory to a file on your hard drive and loads that file when you next start the virtual machine.

image

Improve Performance Inside the Virtual Machine

You can improve performance inside the virtual machine in the same ways you would on a physical computer. For example, reducing the amount of background applications and programs that run at start-up will improve your guest operating system’s boot time and reduce the amount of RAM used by your virtual machine.

You may also want to consider not running an antivirus inside your virtual machine — for example, if your virtual machine is isolated from the Internet, an antivirus may just be slowing things down. Of course, there’s a security trade-off here – if you use a virtual machine that’s connected to the Internet, you may want to stick with an antivirus.

Running a disk defragmentation program inside your virtual machine may also help.

image

Defragment & Compact Virtual Machines

You can improve performance by defragmenting your virtual machine’s disk files, just like you can defragment other files on your computer – fragmentation could be particularly bad if you use a dynamically expanding disk.

VMware has an integrated tool for this, while you’ll have to use another defragmentation utility if you’re using VirtualBox.

After defragmenting a dynamic disk, you may also want to compact it – the compact operation shrinks a dynamic disk, making it take up less space on your hard disk. Because the file size is smaller, the virtual disk may load faster. VMware has a “Compact” option in its interface, while VirtualBox users will have to use the –compact operation on the command line.

image

Try Another Virtual Machine Program

Some people report VirtualBox being faster for them, while some report VMware being faster. Which virtual machine program is faster for you may depend on your host operating system, guest operating system, system configuration, or a number of other factors – but if you’re not seeing satisfactory performance, you may want to try another program. VirtualBox is completely free, while VMware Player is free for non-commercial use.

image


Do you have any other tips for maximizing virtual machine performance? Leave a comment and share them!

Chris Hoffman is a technology writer and all-around computer geek. He's as at home using the Linux terminal as he is digging into the Windows registry. Connect with him on Google+.

  • Published 09/19/12

Comments (17)

  1. dc1

    Great guide, did apply already some of the tweaks but not all of them, like Intel VT-x.

  2. Cambo

    In Windows, avoid the fancy “Aero” effects, and switch the performance in the System Properties to “Adjust for better performance”.

    Aero looks nice, but it’s a hog on resources- especially in a VM.

  3. clakes

    can some one give more detail for the tip “Allocate More CPUs”?

    is it refering to the number of CPU’s (as in number of sockets on the “mother board”) or is it refering to the number of core’s per CPU?

  4. TheFu

    When I saw this article, I expected it to be 100% rehash of mine.

    A few caveats.
    * Always leave at lease 1GB of RAM for the HostOS. If the host is starving for RAM, the VM performance will suck.
    * Using any USB drive will suck compared to SATA, eSATA or IDE. USB, even USB3 has queuing issues.
    * Virtualizing high-graphics GUIs sucks. Avoid it. Turn off Aero. Don’t use Unity3D or Unity2D. Go with LXDE or XFCE if you can’t live with a pure Window Manager like fvwm.
    * Allocating more CPUs is seldom a good idea. Use 1 CPU for a desktop VM and if you are trying to virtualize a server … don’t use VirtualBox, VMware Player, …. or any GUI-centered VM “hypervisor.”
    * If you are running MS-Windows and you think you might need more than 1 CPU, install the VM with 2 vCPUs to get the correct HAL loaded, but go back to 1 CPU for most use. Linux VMs will dynamically scale if you add more CPUs later.
    * Do not over subscribe RAM, CPU or networking. If you have a dual core machine, leave 1 core for the hostOS to have. If you are running multiple VMs + the hostOS, telling each that it has 2 cores is crazy.

    And it would be nice to know why my comments are being held for “moderation.” Every “moderated” comment has been turned into a HowToGeek main article the following week. Nice, but ….

    I love-love-love virtualization and have been using it constantly the last 5 yrs. My main desktop is a virtual system so that any hardware failure is a minor inconvenience. I can hit any big-box computer store, buy a new laptop with or without any OS, take it home, load up VirtualBox and reload my VMs from backups. Sure I lose a few hours doing that, but the backup restore brings back my normal desktop, with all my programs and settings, and since it is inside a VM, the physical hardware changes don’t matter at all. The virtual hardware is the same.

    Of course, I can’t play high-end games inside the VM, but for most programming or office productivity or web apps, VM desktops are fantastic.

    Virtualization completely rocks once your setup performs well.

  5. Jonathan

    Virtual CPU’s are basically just threads of time to be running on the host processor. That is why you can allocate a bunch of virtual cpu’s but only have a single dual or quad core processor. You can even tell which virtual cpu to use a certain host core or host cpu, which can make it more efficient also.

  6. Bruce (PMToolsThatWork.com)

    When I do an OS upgrade or move someone to a new PC, I always take their old PC virtualize it (usually using vmware convert) and put it on their new system in its own partition/drive. This way they can “bring up” their old system if they find there is something, a program or file, they need that they’ve not yet moved over to their new PC/OS. In some case, such as upgrading to Win7 from XP, there are old programs which will simply not run. Having the VM of there old PC allows them to run those old programs.

  7. Kits47

    Does any of this apply to Win XP Mode? Or has MS implemented that differently, in some or all ways?

  8. Mister Know-IT-all(most)

    If you use a Linux guest OS with Virtualbox then you probably don’t want to install the “Guest Additions” as described. You probably can do it, but you may want to rely on the Linux updates process or actually install the guest additions using something like Symantec (for Debian derivatives like Ubuntu) – assuming you have access to the Internet and access to a well maintained repository.

    But if your Linux guest OS doesn’t have access to the Internet then you will probably need to mount the guest additions “disk” in your VM client somehow (which is really just an .iso file in your Virtual Box folder) thus making it visible to the Linux guest as a CD, and install that way. Sometimes this can involve actually getting into a Linux terminal to mount the CD and then run the guest additions installation from a command line – which is not exactly a whole lot of fun especially for a Linux newbie. And I say “probably” since you may not even be able to do this if your Linux distro doesn’t support installing from a .deb or a .rpm type PPA file. (Sorry. I forget exactly what’s in that .iso image these days. I just know that when it comes to Linux that it’s pretty limited and pretty much only contains a .deb or a .rpm file that you can use to install your guest additions with.)

    Simply clicking on the “Install Guest Additions” from the Virtual Box Devices menu as described really just tries to mount the guest additions .iso for you (as a CD visible to your guest) and then hopefully your guest tries to run the installer. But as I said, this doesn’t always work with every single Linux distro out there. In fact, with recent Debian derivatives like Ubuntu I haven’t even got it to work! Therefore, if you can, you may just want to just use whatever repository your distro prefers to use and install any guest additions that way. It’s much easier! (But again, that’s assuming your distro and it’s default repository even support guest additions.)

  9. 0xRiddle

    I must really agree with The Fu .. specially regarding Aero and allocating CPUs .
    If you give all of the cores for the VMs your host will have to share them with the guests ,the processor will stop at every cycle and switch between the systems. That will utterly kill performance .
    If you are really into virtualization you can try hypervisors like Xen or hyperV .

  10. Brad

    I often get slow downs using VM when presenting over webex.
    E.g. VMware running fine and fast on machine
    Then run a webex session and VMware grinds to a halt
    Like there is a conflicts between the 2. Anyone expierenced these issues before?
    I5 460m 2.667 dual core laptop HP, 8gb DDR3 , 7200rpm Sata drive
    Running a shockling big vm 30gb with mssql app on it. No antv on VM.
    I might answered my own question would my connection play role in performance?
    Only thing I haven’t considered? This work demo situations usage.

  11. Sol

    I often fall asleep during long comments.

  12. TP

    Can these tweakes be made when the VM has already been built or should they be done with a new build? Cause I have my VM of Win 7 just the way I like but I want to improve the speed and reaction time.

  13. Ray

    0xRiddle and TheFu. That’s a pure nonsense how allocating all CPU’s will kill performance. Yes, if you run heavy CPU tasks in each one they will kind of fight for resources. Like encoding 2 videos at the same time would on a host OS. Usually no one does that and if one is working in the guest OS it’s almost 100% means that the host OS has 0-1% CPU needs and no slowdowns would happen. AND if someone follow your “advices” they will have 1-2-3 cores sitting and doing nothing while 1-2 cores for the guest OS are struggling to perform the task which have been easily paralleled between all 4 (6,8…) cores that you actually have.
    Increasing number of CPUs from 1 to 4 in VBox speed up build for me almost 3x times.
    So please don’t give such clueless advices.

  14. bobgrosh

    p I’d like a guide for creating a win 7 thin client. Anyone have a tips?
    I know MS created a thin client for win 7 enterprise but I have no idea how to get it.

    Currently I re-purpose old PC’s and laptops by installing windows 7, removing all windows components except those needed by the display, keyboard, mouse, network and sound card. Then I use windows remote desktop to get into a VM on a modern multi-core PC either via a gigabit Ethernet or vpn over the web.

    I set the old PC or laptop to send a |wake-on-lan magic packet to my router to be sure the host is up and then auto-it into the remote desktop connection to the VM. This breathes new life into those old single core machines and makes them perform like the modern multi-core processors that host the VM.
    Boot time on the old re-purposed laptops is usually improved over their original XP OS and I usually hibernate them, they will automatically re-connect to the host when they come out of hibernation.

    But…. I can’t help feeling that I could remove even more from windows 7 to make it even quicker. I haven’t found much at Microsoft about their thin client version of Windows 7 or how to re-create it.

  15. ashish

    Is there any suggested tool or commands for linux guest, to measure performance (before & after) ?

  16. oharamj

    Lots of good stuff here, and have become real fan of using VMs over last 6 mos. Especially the ease of backup. BUT, one BIG caveat learned the hard way: if you’re using older Mac (say 2009) Core 2 Duo you’re going to find yourself relocating some key Apple apps back to the host. E.g,, while iTunes runs in a VM, you can’t show cover art flow. While you can start iWork ’09 apps in a VM, the document won’t appear – it’s there, but doesn’t display. Similar issues with iPhoto. After MANY hours on phone, email and forum conversations with tech support it appears that there are two issues at play: 1) both VMWare and Parallels acknowledged they don’t/can’t virtualize some kind of “Core” graphics / GL whatzit that Apple uses to accelerate graphics and 2) in late 2009 some Intel Core 2 Duo chips had “VT-” installed and some didn’t. Probably a choice of the laptop maker. Net effect is forget running nested VMs.

    Since I can’t figure out how to enter the Mac’s BIOS, I can’t even tell is I have VT-.

    I don’t know when or if all these hurdles have been fully resolved in later Apple laptops – does anyone know?

    Anyway, FWIW.

    Rig: Apple MacBook “late 2009″; 2.26 GHz, 8GB RAM, 7,200 rpm 500GB HD; OS X Mountain Lion 8.1, VMware Fusion 4, Parallels, Virtual Box

  17. Inside_Intel

    lol…

Get Free Articles in Your Inbox!

Join 134,000 newsletter readers

Email:

Go check your email!