e thought we were going to cover a lot of topics in this episode of .NET Rocks!
, but we managed to go over an hour without straying from Virtual PC at all. This is a must-listen show for anyone who isn't already an expert in Virtual PC or Virtual Server. Brain explains the advantages and disadvantages, warns you of some potential pitfalls, and shows you how you can boost performance!
Brian A. Randell is a senior consultant with MCW Technologies, LLC, a Microsoft Certified Partner. Over the last 18 years, Brian has worked with companies and their developers to help to create solutions that leverage various Microsoft technologies. Today Brian splits up his time teaching Microsoft .NET -based technologies to developers, working with new and emerging technologies like Visual Studio 2005, SQL Server 2005 and Visual Studio Team System, and consulting worldwide for clients such as Microsoft, American Honda, DELL, and others. In addition to consulting, he speaks at events such as VSLive!, TechEd, and the PDC. He is the co-author of Effective Visual Basic
and the forthcoming Tom and Huck's Guide to Visual Basic Express
(both from Addison-Wesley) and has written articles for MSDN Magazine
and Microsoft. You can reach Brian through his blog
Carl Franklin: All right. Let's talk about performance right now. So let's assume that you have a Virtual PC session totally full screen. In other words, you have control. Let's say you've got a gig of RAM, and you've assigned the maximum amount of RAM or, the maximum amount of RAM you should have, which is about 700-something Megs?
Brian Randell: Yeah, give or take.
Carl Franklin: So what kind of performance degradations are you going to find?
Brian Randell: Well, see, here is the problem: it's multiple things. Number one, the two things that make the biggest difference are the amount of RAM you have on the host operating system, the spindle speed of your hard drive, and if you have multiple hard drives.
I've done [some] diagnostics. For example, just the difference between a 5400-RPM drive and a 7200-RPM drive is noticeable. So that's the biggest thing you can do for performance is get yourself a fast, separate hard drive from your host operating system, and make sure you have gobs of RAM. And those are the two things right away, and you won't make the big mistakes. They run stuff on 512 Megs of RAM on a 4200-RPM laptop drive.
Carl Franklin: Yeah. And a RAID Stripe will work, too?
Brian Randell: Absolutely. Anything that is going to give you better performance will work. I mean, as far as the virtual hard drive is concerned, it's just a big file; so as long as Virtual PC or Virtual Server can see it, it will work fine.
Carl Franklin: Are there any optimizations you can do in terms of where to place that file or index it or anything?
Brian Randell: Absolutely. It's just like a swap file. You want it on a separate spindle field hopefully, a separate physical drive than your host operating system. That's the number-one thing. And then if the virtual PC has multiple drives, just partition them across multiple physical drives, also. The other thing is, there are different types of virtual hard drives we probably should talk about.
Carl Franklin: Okay.
Brian Randell: What most people do when they set up a virtual PC is, they take the defaults, and they like it. It's the dynamic hard drive, which basically means, inside. The guest operating system sees it as an X gigabyte-size drive. The max you can have is a 16-gig virtual hard drive inside.
On the outside, though, it only takes as much space as you are actually using. So you start off with, say, installing Windows, and if it's Windows XP, for example, it takes about a gig-and-a-half. So your guest operating system thinks it has 16 gigs of total disk space with, say, 14-and-a-half free; but you're only using a gig-and-a-half on the host drive; and then as you use disk space, it slowly expands.
The problem is that slow expansion is just like correcting it on ROM, Richard, when you have dynamically expanding databases. It's a benefit that has a performance penalty.
Richard Campbell: But it's two things. One is, it takes time to allocate disk space; and the other thing is, it's fragmenting.
Brian Randell: Exactly. And so if you want the best performance, use fixed hard drives and pre-allocate them. And when you do that, you can actually see significant performance improvements. Some are them are subjective; but that is measurable over a dynamic disk. The other thing is, you've got to keep your host drive defragmented, and you've got to keep your Virtual PC hard drives defragmented. Those are huge things that if you do on a regular basis, you'll have noticeable improvement right off the bat, besides buying better hardware.
Richard Campbell: And more memory.
Brian Randell: More memory.
Carl Franklin: Inside Virtual PC, does it just look like you have more disk space available all the time?
Brian Randell: Yes, it looks ... whatever you set the maximum to be, which in Virtual PC is 16 gigabytes; if you even use 2 gig, you've still got 14 gigs free.
Carl Franklin: Well, what if you use 40 gigs?
Brian Randell: You can't.
Carl Franklin: All right. So you can only have a 16-gig drive.
Brian Randell: Right now in Virtual PC, that field is the maximum for what Virtual server drives are.
Carl Franklin: Oh, okay. All right. I thought when you said it "expanded", I thought you meant it would expand past 16 gigs.
Brian Randell: No, it all expands up to the limit of the size when you create it. You specify how big you want the limit to be.
Carl Franklin: Yeah, and the limit is 16, okay.
Brian Randell: It's currently 16, and I forget what the Virtual server number is. The Virtual server number is much bigger, because they support virtual SCSI drives. The drives in Virtual PC are IDE only.