October 27, 2006
If you use virtual machines at all, you should have the single most important virtual machine performance tip committed to heart by now: always run your virtual machines from a separate physical hard drive:
[the] biggest performance win is to put the virtual hard disks on separate disk spindles from the operating system. The biggest performance hit in virtual machines is disk I/O. Making the VM fight with your OS and swap disk makes this issue much, much worse. Additionally, today's USB 2.0 and firewire external hard drives run on a fast interface bus, have large buffers and spin at 7,200 rpm, as opposed to 4,200 rpm for most laptop hard drives.
I've talked about virtualization performance penalties before, but this bears repeating. I originally read this tip at Scott's blog, and I've heard it echoed in emails directly from the Virtual PC Guy himself.
It's true that most laptop drives are at 5,400 rpm these days, and a scant few even run at 7,200 rpm. But the tip is still as valid as ever. The primary performance bottleneck in virtual machines, by a very wide margin, is the hard drive. Although it's possible to squeeze a complete install of Windows XP into a 641 megabyte VM hard drive image file, most VM hard drive image files rapidly grow to multiple gigabytes. It's not unusual to see VMs end up 5 or 10 gigabytes in size. It shouldn't be too surprising that the disk subsystem has a disproportionately large impact on overall virtual machine performance.
That's one reason why all the desktop machines I build now have two hard drives:
- A faster, smaller drive for the operating system and essential applications. You can't beat the 10,000 rpm Western Digital Raptor series for this role.
- A larger data drive for virtual machines and everything else.
This way, whenever I boot up a VM, it's running from a different physical spindle than the operating system, and thus running at optimal speeds. It's also a good way to segregate your operating system and data in case you need to do a complete wipe of your operating system. And it's certainly a much safer and more practical two drive approach than RAID-0 on the desktop.
Unfortunately, we can't drop a second drive into our laptops. But there's another solution that works almost as well: external SATA and USB2 enclosures. These enclosures offer the best of both worlds: high-speed USB 2.0 interfaces for laptops, and full-speed eSATA connections for desktops.
The Icy Dock, pictured above, is one of the best of these new enclosures. It's a bit spendy, but it's remarkably well made from mostly aluminum, with a clever locking tray mechanism. It also includes all the extras you need to connect it to your PC, including a USB 2.0 cable, an eSATA bracket, and an eSATA cable. Just add the desktop SATA drive of your choice.
I've talked about the difference between USB 2.0 and full-blown SATA performance before. Here's a direct comparison between a modern 250 gigabyte 7,200 rpm SATA drive in the Icy Dock (connected via USB), and my laptop's internal 100 gigabyte 5,400 rpm hard drive:
The USB 2.0 interface is nothing to sneeze at. With a fast 7,200 rpm desktop drive mounted, it does a little better than the internal laptop drive overall, once you factor in random access times and the constant speed across the entire drive. But it's obviously limited by the interface. That's why the option to connect a drive via its native SATA interface is so desirable in an external enclosure. Some recent motherboards even include eSATA connectors on their back panel, such as the Asus P5B that I recently built. I presume it's only a matter of time before some enterprising laptop manufacturer releases a laptop with an eSATA connector.
It's not a slam-dunk performance victory over the internal laptop drive in absolute terms. But the real-world performance improvement gained from running a VM on an external USB 2.0 drive is quite noticeable. Recommended.
Posted by Jeff Atwood
Are you sure your laptop won't accept a secondary harddrive. Most brands I have see do accept them with an adapter. On my current Thinkpad T41 it was a 50 dollar option. I had the same thing on previous Compaqs and Dells too. I lose a CD/DVD, but I save the ISOs of the important ones on the drive. Plus I have had occasional power problems with external USB drives...but then I live in VMs in front of an audience for up to 8 hours at a time... But having access to a fast and big external drive looks interesting too....
seeing a straight line in the HDTach report is indicative of a problem...
I guess I wasn't clear in the post. The drive was connected via USB 2.0 in the IcyDock.
Hey Jeff, just wondering if you have ever tried any of these laptop eSATA cards which allow attaching an external drive using eSATA:
I'm looking to purchase a new machine and am thinking i'll go the laptop route rather than buying a big bulky desktop, especially considering most LCD monitors provide a pretty poor picture compared to a good quality CRT. I currently have a dell latitude C800 (yes, that's 800 Mhz!!!) which I keep on using because it has a native resolution of 1600x1200 - something almost impossible to find on a laptop these days...
Actually those 10,000 rpm WD Raptor's are pretty pricey for their performance "gain" when if you short stroke a much cheaper larger capacity 7,200 rpm drive (e.g. 320gb $100 vs. 150gb Raptor for $150) to the same size (i.e. 150gb to match one edition of the Raptor) you can virtually get the exact same performance for any data on that partition of the drive.
It's not the real deal and has its drawbacks but it can be a nice alternative for those on a budget.
Jeff, what program are you using for your benchmarking? I'm curious about the speeds for my network drive in USB/network configurations, and how they compare to your trick Icy Dock.
laptop eSATA cards
Hmm, I never considered that. Are there any performance benchmarks for drives attached via eSATA cards? I suspect it will still do better than USB 2.0, but I wonder by how much.. the interface will still be a bottleneck.
what program are you using for your benchmarking?
I used the free version of HDTach:
if you short stroke a much cheaper larger capacity 7,200 rpm drive
I'm really skeptical that this actually works. Do you have any performance benchmarks or links to substantiate your claim?
Jeff, you said:
laptop eSATA cards
Hmm, I never considered that. Are there any performance
benchmarks for drives attached via eSATA cards? I suspect it will
still do better than USB 2.0, but I wonder by how much.. the
interface will still be a bottleneck.
I think Andy was suggesting a CardBus or ExpressCard ESATA interface. Why would that be any slower than a desktop machine with a PCI Express ESATA card?
laptop eSATA cards
Yes, I meant using a Cardbus or ExpressCard eSATA card to attach an external SATA drive to a laptop.
There is no bottleneck compared to USB as Cardbus runs at 132 MB/sec and ExpressCard at 500 MB/Sec compared to 480 Mb/sec (60 MB/sec) for USB 2.0. If comparing to SATA, then Cardbus would only offer 1/3 the speed of SATA II (3Gb/sec) but ExpressCard could handle this and more. Correct me if I am wrong - may well be getting my bits and bytes mixed up! ;)
I was thinking of getting one of these cards for my laptop and hooking up to a pair of RAID Mirrored SATA drives using the thecus enclosure (http://www.thecus.com/products_over.php?cid=1pid=3). It would mean not having to do backups, which would be a major bonus... anyone tried anything like this?
laptop eSATA Cards
found a good benchmark article here:
from this, it sounds like laptop performance using an external SATA drive on an ExpressCard interface is pretty much identical to desktop using the built in SATA ports...
Jeff, seeing a straight line in the HDTach report is indicative of a problem... It means the HD being tested is limited by the IDE interface. Another clue is that you are hitting exactly 33MB/s all over...
I recently fixed a similar problem on my home system; incorrect BIOS settings caused the hard drive to get stuck in UDMA2 instead of a more tolerable UDMA6.
Once I fixed this, performance was much better, and I was getting a more normal "gradual" curve in HDTach.
In the graph, I assume (from the model numbers) that the red line is your internal SATA drive, and the blue line is your external USB drive.
No, it's the other way around. That's why the blue line stops at ~100gb, because that is the maximum capacity of the internal laptop drive.
nice tip, but I can't use it. All I have is a laptop (HP nx8220, 2 GB RAM, 100 GB 7.200 hd). Ok, and a dockingstation and a Cherry keyboard and a mosue and 2 19" monitors (2x22" wide soon). All development is on VMs, from 500 mb up to 14 gb. If I put them on an external drive, I get
1) more points of failure (USB interface of the external drive, external power supply, another harddisk)
2) problems to have everything at hand at the customers site
3) problems to transport that external drive, it will not be as shock resistant as the one built into my notebook.
4) problems to find a power connector when I am out of office for the external drive
5) problems with different voltage in different countries (second adapter, I'd need a drive that can take the voltage)
6) problems with the backup (right now, I simply create Acronis images every night on an external drive.
If you ask me: more memory is the key. It works at least for me.
The drive was connected via USB 2.0 in the IcyDock.
I guess I wasn't clear in my response :) In the graph, I assume (from the model numbers) that the red line is your internal SATA drive, and the blue line is your external USB drive.
My point was that the SATA drive is most likely connected to a misconfigured controller. Being stuck at 33MB/s for an entire test run is highly suspect.
What I'm trying to say is, the comparison is incorrect, since your internal SATA drive isn't running at peak performance. That being said, I still agree with you that a separate hard drive is a must for speeding up many disk-intensive apps, but the real difference may be less than your test implies.
I can tell you empiracally that Linux is a better place to run a VMWare VM than Windows is. In fact, Windows in a Linux VM is generally faster than Windows running outside of a VM on this machine (ThinkPad T43, 2GB RAM, 100G disk). These results surprised me -- I didn't expect them -- but they are real and have forced me to switch to Linux as my main platform for the first time ever.
There's no empiric proof in any of that text. If you can point to actual benchmarks that show a difference, please do.
I've been doing dev 100% on VMs for over a year using VMs in the 20G range. I only use secondary drives for the development, and here are my comments on your qualms about doing so:
1) Buy highly-rated equipment. If your USB interfaces and disks are frequently failing, you need to look closely at your procurement process.
2) I use a Seagate 100GB external USB 2.0 drive. It's smaller than the drives that can be assembled by buying your own bare drive + enclosure. In fact, it's about the size of a PDA. It doesn't require an external power supply -- it runs off the USB power. It's only 4200 RPM, but it's far faster than running the VM on the same drive as the OS. It has been absolutely no problem having this at a variety of customer sites for the last year or so.
3) AFAIK the disks used in the external USB drives ARE laptop drives. Unless you've modded your laptop with extra shock prevention, that is. In any case, I've dropped my Seagate off desks many times without any problems. It's robust.
4) Buy a drive like the Seagate that runs off USB 2.0 power.
5) See #4, this is a non-issue.
6) Why can't you backup a USB drive? I backup my VM by copying it to network shares/other drives/ etc. It's a file copy. What makes your internal drive special?
In addition, using a USB drive for your VM insulates you from OS/computer problems (just plug the drive in somewhere else). Plus, you can more easily share the VM with others when necessary (i.e. copying the VM over USB to their machine vs. copying it over a LAN).
In short, I think these are all bogus issues. If, like me, you've already maxed out your laptop's RAM (where are the 6GB laptops?!?), a USB drive is a fantastic platform for running your VMs. Just get one, you won't go back.
One more tip -- run your VMs in Linux. I do my dev inside a Windows VM (see my prior comment), but I host the VM in Linux. Why? Simply put, Linux uses the hardware more efficiently. Whereas Windows constantly pages while running the VM, Linux doesn't. In Windows, I can barely get anything done when VMWare is the only application running; in Linux, I can run Thunderbird and Firefox and music players etc. while I work in VMWare. I dual-boot, so I am comparing apples to apples on the same machine. I can tell you empiracally that Linux is a better place to run a VMWare VM than Windows is. In fact, Windows in a Linux VM is generally faster than Windows running outside of a VM on this machine (ThinkPad T43, 2GB RAM, 100G disk). These results surprised me -- I didn't expect them -- but they are real and have forced me to switch to Linux as my main platform for the first time ever.
I'm not trying to wantonly dis Windows, but these results have been consistent for me. Try it yourself and you'll be happy with the results.
A question to those "doing dev 100% on VMs" -- can you please tell me, are you saying that the VM has the whole development IDE too so you're running editors, compilers, whatever inside the VM?
Do you have separate VMs for web server, database server, etc or would you have a single VM with development environment, web server AND database server?
I'm just intrigued to know which route to follow. I currently only use VMs for testing web sites in lagacy browser, like IE6 (I guess it's "legacy" now IE7 is out) but have always wondered how practical it would be to do everything within a VM.
In response to windows running faster within a vm running on linux as opposed to running on its own. Of course your not dissing windows, as you're still running windows. What you've done just proves to say that windows is a great operating system and should run a lot faster if only it had the right drivers. The system running under vm is using the linux drivers to access the hardware and then the vm system is jumping onto those drivers.
Here's a direct comparison between a modern 250 gigabyte 7,200 rpm SATA drive in the Icy Dock (connected via USB), and my laptop's internal 100 gigabyte 5,400 rpm hard drive
Need to update graphic or text description below. Which graph is USB? And why does the red one stay constant at 30 Mb/s?
Thanks for any clarification