Wherever you go, there you are.

Technology is Neat, or How I Learned to Love the Virtual Machine

serves into machine funnelIn my last post I talked about my current development environment, and one key aspect of this environment is the use of virtualization and virtual machines. While virtualization is not a new concept (to me or to the world), it has only recently crossed into the realm of day-to-day utility in my life, and I find the entire topic to be one of those eye-catching technological wonders that throws me back to the first time I turned on a VIC-20 or started hacking away at an Osborne. In short, it makes me smile and think, "Hey... that's really neat!".

Virtualization can mean a lot of things, but lately it's been the new, trendy way of talking about what used to be lumped in with emulation. At the technical and semantic level, they are not the same thing: in emulation, the hardware you present inside the VM is entirely abstracted and is often not the same as the physical hardware of the host (e.g. emulating a Nintendo-64 on PC hardware), whereas in virtualization the guest machine sees the architecture of the host and probably even has direct access to some of its bits and pieces. From a practical standpoint, the most common end-goal for both is the same: inside a "host" OS running on real, physical hardware, create one or more "guest virtual machines" (VMs or guests) that look just like real, physical machines to anything that runs on them. The practical upshot of all this is that one piece of physical hardware can be running multiple OS instances, not even necessarily the same OS, and they all think they are running on their own little piece of hardware without a care in the world.

Again, this is nothing new. Virtualization has existed as a practical reality since at least 1972. My first negative experience with it was VMWare, and my first positive experience with it was Xen. But only recently has it truly become a useful tool for my day-to-day tasks, for a number of different reasons.

Virtualization used to be very slow and buggy in the x86 world, which is one of the major reasons that I stayed away from it. VMWare was always such a let-down for me; what they accomplished with the hardware at hand is really pretty amazing, but for day-to-day use it was far too slow and unstable for my tastes. However, hardware support for virtualization finally entered the mainstream x86 processor market (AMD and Intel CPUs) around 2007, which has opened up a world of stable and fast virtualization options.

Another limitation had always been hardware resources, and specifically memory. I've rarely had enough RAM to comfortably run my regular OS, let alone a couple of tag-along virtual machines. It's not always been just about price, but also the 4GB RAM barrier of a 32-bit OS. But with Vista 64-bit and the current prices for RAM, I've finally been able to afford and actually use a surplus of cheap memory; far more than my OS currently needs, and more than enough to handle the requirements of several VMs simultaneously.

Lastly, there seems to be a wellspring of VM options these days. VMWare has come out with a free version, Microsoft has entered the fray, and there are a number of other choices. With all of these options, I was able to find one that met my needs: Sun's VirtualBox. It's free (hey, what can I say, I'm cheap). Setting up a VM is easy, running multiple VMs is stable, and it "just works". It supports seamless mouse and keyboard integration with the guest machine, so the window running the guest OS behaves almost identically to every other window on my desktop. It supports a network mode that gives the guest OS full visibility on my internal network through promiscuous use of my NIC (sounds kinky, I know, but it isn't). And it can share files and folders on my host OS with the guest OS through an embedded file-share device that behaves just like a network mount.

With all of these forces combined, I've suddenly started using virtualization all over the place. As I already talked about in detail, I've been using it to run a guest Linux webserver VM on my Vista host in order to serve up the web apps I'm actively developing. I also use it to run a Windows XP image in order to test with IE6.

Once I started with this setup, I found other handy uses for my little virtual machines. For instance, my day-job requires that I spend a lot of time connected to various corporate VPNs, and these have an annoying tendency to kill my regular network connectivity. Also, a lot of them don't work very well on Vista; especially not 64-bit Vista. No problem now, though; I have an XP VM dedicated just to VPNs. It has all of my VPNs configured and I can connect anywhere I need without killing my host OS network. Even better, when I go on the road, I simply copy over the VM image to my laptop and run it there, without having to worry about maintaining two sets of configurations or worrying about OS compatibility.

And perhaps the most endearing and important aspect of it all is that it's just really neat! Running a Linux webserver in a little window on my Vista PC as I edit the files it serves up in real-time on my host OS while simultaneously testing these changes using IE6 on another version of Windows running inside another little window... well, that's just fundamentally cool. And I don't even take advantage of all the other nifty things you can do with virtualization, like migrating a running virtual machine from one physical machine to another without interruption, or scaling physical resources on demand between multiple VMs. With all of this cool techno-wizardry going on, it's easy to see why I finally learned to love the virtual machine.


Post a Comment