I had the opportunity to sit down with a good friend a few weeks ago (yea, I’m slow on blogging this) and catch up on work and life. He’s a busy guy so at most I might talk to him once every couple weeks on his drive home from work or we’ll chat briefly via IM (or using the in-game WoW chat), but that’s about it. We must have sat and talked for almost 4 hours, covering a wide range of topics including outsourcing/offshoring, training, the community, product development along with a few other things. One item we discussed is the idea of using virtual machines for every day work. He and I are both surprised when we talk to developers who have either never heard of using virtual machines for development, or those who have heard of it but for whatever reason, choose not to take advantage of it.
Reasons why
Anyone that’s ever built up their own development machine knows that it takes forever (or at least feels like it). Between installing and configuring the OS, Office, developer tools and all the little utilities that make our lives easier, it can easily take a day or more to get a new computer to a point at which we can be productive. As a consultant, I deal with a variety of clients, each with their own environment. Some are still on .NET 1.1, some are on 2.0, some don’t care (which means whatever is newest), one even has me doing some maintenance work on an old VB6 application and I had a client last year that wanted me to work with a 3rd party CMS product that I’d never heard of. Since I also like to keep up with some of the cool betas coming out of Microsoft, trying to keep a stable development environment would be next to impossible without the heavy use of virtual machines.
For the last couple of years, instead of cluttering up my primary development machine (my laptop) with various versions of my dev tools, I’ve been using virtual machines to do all of my software development work. When my laptop died in January, I was able to continue working from my desktop machine without having to do anything other than fire up a remote desktop session to connect to one of my many VMs and I was good-to-go.
How I do it
While I know some people love VMWare, I’ve been a big fan of Microsoft Virtual PC and Virtual Server for a few years. Virtual PC is nice for those times when I need to take a VM with me such as speaking at an event or user group, but for the most part, I have a nice beefy server that runs Virtual Server. I currently have seven virtual machines on my server with four running at any given time. My laptop is nothing more than a tool to run Office 2007, my IM client, my twitter client, connect to my VMs using remote desktop and of course, play World of Warcraft.
In the whole scheme of things, my server isn’t anything special. In fact, it’s a home-built AMD Athlon 64 X2 3800+ with 4GB of RAM running Windows 2003 server. It’s currently got something like 500GB of drive space. Not only do I run Virtual Server on that system, but I also run Sharepoint, my internal subversion repositories and it’s where all our mp3s and pictures live. To be honest though, up until recently, the mp3s all lived on an old Shuttle box I had laying around. Even with all of that running on the server, the performance of my VMs isn’t bad at all. In fact, my biggest complaint about working this way is that sometimes the display can suck – for example, if I’m working on a Silverlight app, but that’s easy enough to get around.
When I made the decision to start using VMs, I started out with a single Windows XP/sp2 installation that I created using Virtual PC. Before backing that VM up, I made sure all my common utilities were installed including BGInfo from sysinternals, a decent zip utility, FileZilla, GViM and Reflector. Once I had that base image working, I backed it up. Using a copy of that base VM, I created my first “working” VM. I installed Visual Studio, SQL Express and tortoisesvn. Once I had the specific version of those tools I needed installed, I backed that VM up as well. Keep in mind, going this route requires a lot of disk space, but hey, disk space is cheap, right? Most virtualization software allows you to reduce the amount of disk space by using “differencing” disks. This means you start with a base image and new VMs based on that image are only the differences between the base. I’ve heard good and bad things about this approach. The bad includes breaking all your images IF you happen to make a change to the base image *after* you’ve created new images based on it.
When a new client comes on-board, it’s easy enough to copy one of my “base” VMs, rename it and fire it up. I love being able to work on a client project without affecting any other work I’m doing. I can easily copy a VM to my laptop if I need to go onsite and I can easily blow away a VM if it becomes unstable.
I know of a few other developers who have gone the virtual route and are from what I’ve heard, they love it. What do you think? Do you have experience developing in VMs? Do you love it or hate it? Let me know!
Have you played around with Hyper-V yet? I’m hearing tales of significant performance gains over VS.
I would love to try it out, but I haven’t been willing to burn the time required to upgrade my 2003 server to 2008.
This is great advice. I personally use VMWare, not that it matters really, and also build a seperate VM for each client and great the entire environment I need for the client.
This is a great way to keep everything seperate and independent. As I go from system to system I can easly move VM’s around and not have to worry about the base system.
I have too often needed to upgrade my main development system and have to move client stuff over but those days are gone, my main system is pretty plain and I just use VMs.
So +1 for love it.
I’ve just started really getting into VM’ing. My original thought was to set one up per technology. Meaning, .NET 1.1 VM, .NET 2.0 VM, etc.
However, you’re explanation of one VM per client is a far better idea.
Thanks for the post.
I love VM’s and prefer VMWare. I do occasionally install Virtual PC and give it a run but always find it has significant performance issues compared to VMWare (or Virtual Box). Maybe it will someday get up to speed.
@craig – I’ve heard that VMWare does perform better than VPC from many people. I do in fact have one VMWare VM I use, mainly because that’s what the client gave me.
What I don’t like about VMWare (at least the Workstation version) are all the additional processes that run even when I’m not using it.
1) What about Sun Virtualbox?
2) Visual Studio 2008 and/or SQL Server 2008 are heavy programs I guess I’m not able to run on any VM in my computer which has only 1 GB of RAM.
@Luciano – haven’t checked into Sun Virtualbox. Isn’t that pretty new?
Yea, to run VMs you really need lots of RAM and lots of disk space. It’s also nice to have fast drives. 1GB is barely enough to run Windows…I’d hate to run VS/SQL Server too.
The last time I tried to go the VM route, I stuck with it for a solid week and I just couldn’t tolerate the performance lag from the virtualization. One of the biggest problems for me was with Intellisense.
Because of this, I’ve moved to just replacing my hard drive on a per-client basis in my laptop(s). You can go buy a new drive of sufficient size for $100 and they’re easy enough to swap in and out. Combine this with my nightly full-machine backups (thx WHS) and I think I like this approach much better!
The only big problem that stays around with this is if I have hardware issues, I can’t just put that hard drive into any other laptop. That’s where the VM route beats me. But I consider that a 1% scenario and I’d rather not handicap my 99% scenarios just to be super graceful that 1% of the time.
Do you guys not see these performance lags? If Intellisense is just as responsive for you in your VMs as it is in a normal environment, then maybe I had a bad apple for my one test case that I tried this with. I’d love to know – let me know! Shane _@_ IndyALT.NET
-Shane
@Shane – I found the biggest issue when working with VMs via RDP is the quality of the video card on the host machine. For example, I notice a lot of lag when RDP’ing into my VMs from my desktop because my desktop has 2 low-end cards.
When I RDP from my laptop, I see almost no lag because the laptop has a pretty kick-ass video card.
I found virtual PC very helpful when I needed to test a msi file I built that created folders and modded the registry. It was the only way to simulate the production environment and test upgrade installation variations. I knew the software worked on the dev system but needed to make sure I didn’t have unknown dependencies.
@Maggie – VMs are perfect for what you described.
So far my biggest reasons for not wanting to virtualize development has been lag time and graphics quality.
However, your post has me considering giving it another chance… once I order a better computer.
Thanks for the post!