Scott Hanselman

Virtual PC Tips and Hardware Assisted Virtualization

March 02, 2007 Comment on this post [6] Posted in Reviews | Tools
Sponsored By

I posted a list of tips on Optimizing Performance on Virtual PC a while back, and I'm a big fan of Invirtus VM OptimizerJeff prefers to do the optimizations himself, but the time saved is worth the $70 for a tool like this. With the new Orcas March CTP available as a VM and weighing in at 9 gigs, I need to save all the time I can. Frankly, anything I can do to squeeze performance out of a VM is a good thing.

Be sure to check out Tim Sneath's VM Museum - that's where I snarfed the Windows 3.1 VPC picture.

  • I always run my VMs on a different spindle:
    • I swear by the WDC My Book drives, I've got two at work that we run VMs on and one at home.
  • At work, because we're in banking, virtually EVERYTHING is encrypted. If it's not chained down, it's either encrypted, or encrypting. I use TrueCrypt at the Partition-level with AES on my 500gig drives - the ones I run my VMs on, and you'd think it'd cramp my style, but it's actually not all that bad.
  • I run VM Optimizer (the automated version) on all my drives.
  • I have 4 gigs of RAM on one machine, and 2 gigs on the other...I tend to dedicate between 512M and 768M to my VMs.
  • I run my VMs without swap files if I have dedicated enough RAM to them. 
  • I always make sure my VM is running the latest version of the Virtual PC Additions.
  • I turn off features I don't need in the VM. Sound and USB support are often the first to go.

I run both Virtual PC and Virtual Server on my work machine. Why, you ask? Here's my reasoning, from a very good paper comparing Virtual PC and Virtual Server.

  • Host multiprocessor support. Virtual Server scales across multiple processors on the host computer—up to 32. Each running virtual machine can take advantage of up to one CPU. For example, on a 32-processor host computer, you could allocate your CPU capacity so that 31 simultaneously running virtual machines would each use up to one CPU, leaving a CPU free for the host operating system.
  • Multithreading. Virtual Server 2005 is a multithreaded application that runs as a system service, with each virtual machine running in its own thread of execution. In contrast, Virtual PC is a single-threaded application in which all simultaneously running virtual machines run on the same processor.
  • Virtual networking. With Virtual Server, you can create an unlimited number of virtual networks, each with its own virtual Dynamic Host Configuration Protocol (DHCP) server. You can also configure Domain Name System (DNS) and Windows Internet Name Service (WINS) servers, Internet Protocol (IP) addresses, and IP address lease time.

Since I've got a Core Duo machine, this made sense to me. I can dedicate (mostly) a VM to one processor, or more importantly, I can run multiple VMs (often done when doing large demos) and get better performance. When running multiple VMs as a group, you can get better performance by using separate external disks for each VM, and ensuring, if they are USB2, that each disk has its own dedicated USB2 "Root Hub." Avoid during concurrent disk access with two drives on the same USB root hub.

Another interesting feature in both Virtual Server 2005 R2 and Virtual PC 2007 is Hardware Assisted Virtualization or VT Technology. You'll need to turn it on in both apps (Here's how to turn on Hardware Virtualization in Virtual Server).

Note the check box. Here's the trick, though. You not only have to have a CPU that supports this - nearly all newer Intels and AMDs - but often you have to turn it on in the BIOs. My IBM T60 and T60p had this turned OFF by default. Another thing to note is that it's often turned off again after BIOs upgrades. I'm not sure why that is, as it seems harmless, but either way, be aware.

If you're running Intel, refer to this table at Intel to see if your chip supports VT. All the Core Duos support VT except the ones that end in "E" like the Intel Core Duo processor T2300E .

Here's some more details about VT from Intel. Since Operating Systems, by their nature and definition, don't expect to have to share physical resources, they tend to get pissy when asked to. Hardware Virtualization moves a bunch of the "platform management" computational tasks off to the hardware, removing a layer of abstraction. Without hardware help, lots of CPU state information is stored in memory, while with virtualization, it's stored in memory that's dedicated. In a data-center or hosted virtual environment that means that you can't take down the whole "Virtual Farm" by taking down the one VM.

So, now the real question is, does Hardware Virtualization actually make things faster?

Yes, of course it does. But for Windows VMs, it's not like "night and day" different. It's not twice as fast, which some folks feel it should, mostly based on the words "Hardware Assisted" and fueled by past pain of running within a slow VM.

Both Virtual PC Guy and John Howard have done some analysis in this area. Before we get to the nitty gritty, let's just drink in these paragraphs from Virtual PC Guy (emphasis mine):

Now - in order to provide improved performance, our Virtual Machine Additions will (on Windows virtual machines) make appropriate changes to the guest operating system such that we can run the virtual machines kernel mode code directly on the processor too (please note that there are some major simplifications in the above statements).

Hardware virtualization support allows us to run all of the virtual machine code directly on the processor in virtualized mode (with a few edge case exceptions).  So getting back to the original question - what does this all mean for Virtual Server?

Well the first interesting point to make is that it does not make much difference for people running Windows virtual machines with the Virtual Machine Additions installed.  As I mentioned we had already managed to get these virtual machines running almost entirely virtualized (from a processor perspective). 

Basically, this jibes with what I found. It's faster, but it's not like WOW faster when running a tuned VM that has Virtual PC Additions - which is what you should be doing anyway. (Some folks haven't discovered those Additions...make sure you've installed them.)

That said, John did an install of Windows Server 2003 on two VMs, on with hardware virtualization and one without:

Step With Hardware
Assistance
(Seconds)
Without Hardware
Assistance
(Seconds)
Improvement
(Seconds/%)
1: Text Mode Install 236 334 98s=29%
2: Initial GUI Install 167 287 120s=42%
3: GUI Install Completion 733 985 252=26%
4: Boot with additions 10 14 4=29%
 * From John Howard's Blog

He's got some nice charts to check out as well.

From my point of view, check a box, get 10-30% performance improvement. Seems good to me.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

Webinar: Online Banking 2.0

March 01, 2007 Comment on this post [7] Posted in Corillian | eFinance
Sponsored By

UPDATE: A recorded REPLAY of this Webcast is available now.

If you're interested in what Corillian does, or just in Banking and eFinance in general, there's a free Web Seminar tomorrow on Online Banking 2.0, March 1st, at 11AM PT/2PM ET.

It's presented by one of Corillian's Product Managers, Max Janasik, and it's going to be pretty interesting. I worked a little on the PPT deck, but what's really interesting is the influence of Social Networking and the general "Common Sense and Good Feelings" around Web 2.0 that we're trying to start spreading around the Banking Community. Starting conversations with your customers, gaining their trust and general business transparency are more and more an issue in the emerging web.

Also, if you're interested because of Corillian's recent announcement about being acquired by CheckFree, you'll see some interesting UI things that both Corillian and CheckFree are working on, and maybe get a glimpse of what a Next Generation Banking experience might look like.

Be sure to register ahead of time.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

Running PowerShell Scripts from the Command Line in a Hidden Window

February 28, 2007 Comment on this post [1] Posted in PowerShell | Tools
Sponsored By

Dave P. said the comments of a previous post "...but it's ugly b/c it actually opens a command window to do it. Batch files don't have this issue. Now if you can figure out a way to run powershell scripts in a hidden window, then you'd be onto something."

Running PowerShell Scripts from the command line is obscure and yucky to be clear, mostly because of escaping of quotes and such.

If you want to run a hidden powershell script, you can use HStart from the awesomeness that is NTWind Software. (Just go over there and download all of his utilities and save yourself some time).

Here's how to run a hidden powershell script:

hstart /nowindow "powershell.exe -command ""&" 'c:\DOCUME~1\Scott\desktop\foo.ps1'""

If you're going to start running hidden scripts like this, or any script, make sure that you've got PowerShell transcripts started with start-transcript and stop-transcript.

**********************
Windows PowerShell Transcript Start
Start time: 20070228113605
Username : MYDOMAIN\Scott
Machine : SUPERDUPERWONDERFUL-T60P (Microsoft Windows NT 5.1.2600 Service Pack 2)
**********************
Transcript started, output file is C:\Documents and Settings\Scott\My Docume
nts\WindowsPowerShell\Transcripts\20070228.113605.3196.txt

GAC Version Location
--- ------- --------
False v1.1.4322 C:\Documents and Settings\Scott\My Documents\Window...
Setting environment for using Microsoft Visual Studio 2005 x86 tools.

True v2.0.50727 C:\WINDOWS\assembly\GAC_MSIL\System.Windows.Forms\2.0....

Hey! I'm in powershell (this is my script running)
**********************
Windows PowerShell Transcript End
End time: 20070228113605
**********************

You can make your scripts run faster by turning off the profile with the -noprofile switch, but be aware you'll have no profile and might not have some helper functions you've previously setup.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

Office 2007 Foxit PDF Previewer/Handler

February 28, 2007 Comment on this post [18] Posted in Reviews | Tools
Sponsored By

Tim Heuer gives to the community and don't let anyone tell you otherwise. 

Everyone's been waiting ((and waiting) and waiting) for a PDF Previewer for Outlook 2007. I'm shocked that Adobe didn't get their act together in time and release one at the time of the launch. It would have been a compelling enough reason to actually put the crapware software on my system.

Well, of course you know I love Foxit Software because their tiny and glorious little PDF Reader (and PDF Creator) software keeps my computer moving fast and Adobe-(Reader) free.

Update for clarity - I'm complaining about how slow Acrobat 7 is, especially with regard to all it's plugins that it starts up during the splash screen. It's true that Foxit has crashed on larger PDFs and there's some quirky rendering sometimes, but I currently still prefer it for "casual PDF'ing." As for Adobe the company, I love PhotoShop, so I'm not impugning the whole building.

Now, Tim has combined the Foxit ActiveX SDK and an MSDN sample on how to create an Office Preview Handler and just called Foxit up. (The MSDN one uses Acrobat if you like.)

Bam. It was done.

WARNING: The PDF Previewer only works on Vista right now. Tim says via email:

"The problem with XP is that the preview handler model is slightly different.

In Vista, the preview handler is provided through a managed preview surrogate (you can see it running when you do a preview) called prevhost.exe.  In XP, this doesn’t exist and the preview must be handled by a COM surrogate."

Last year Tim wrote a Code Preview Handler (not sure if this works in XP?) so I guess I'll be collecting the best of these, methinks!

Let's all go over and crush Tim's blog with comments of encouragement. And convince him to make XP versions. He says:

"So, the next step for this project for me is to create the managed COM host for this code-base.  I have some stuff researched…but anyone interested in providing that host is appreciated. Time is not on my side for that one."

If you have the expertise and can write the unmanaged COM code, give him a shout.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

Blat - Command Line Emailer saves me time

February 28, 2007 Comment on this post [14] Posted in Tools
Sponsored By

I was reading my boss's blog today, as he's a hard core GTD practitioner - more than I - and I'm trying to get better at it.

He recently went on an automation rampage kick around his home IT and wrote a pile of scripts. He also tends to email him self quick little reminders that are filed as todos, as do I, except he can just type

todo "Write a blog post on foo"

And it'll be mailed to him with an appropriate subject and tagged in his Gmail account.

He's using BLAT under Windows (using sendEmail under Linux). BLAT is a command-line util for sending email under Windows. It'll also post to USENET via NNTP if you like.

You can include all the settings on the command-line, or just "install" them in the registry, once, like this:

blat -install localhost whatever@yourdomain.com - - FromScott

Where "FromScott" is the name of a profile we'll use later. Then I can create a TODO.BAT (or TODO.PS1) and put this in it:

@echo off
blat -p FromScott -to
whatever@yourdomain.com -subject %1 -body %1 > NUL

I like running BLAT with -debug, because I'm all about -verbose, don't you know.

NOTE: I'm using Vista and when I ran blat for the first time I was warned by the loader I didn't have MSVCR71.dll, so I ended up getting it and putting it in the same folder as BLAT then it was cool.

I ended up making todo.bat, worktodo.bat and hometodo.bat and they look like this:

start "TODO-ING" /MIN c:\pathto\blat.exe -p FromScott -to me@noneofyourcheese.com -subject %1 -body %1 -debug

So now,

c:>todo "Write a blog post about how my Home IT is automated"

Enjoy.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.