Friday, 19 February 2010

Tuning Windows 7 performance on VMWare Fusion


VMWare fusion runs great out of the box. It can however be made better, much better. The specific thing I'm going after here is the idle time cpu usage, which my default is around 12 - 14% on my 21.5" iMac. On a friends macbook, I once tuned an XP VM similarly to take its idle time cpu usage down to about 2 - 3%, sometimes lower. Out of the box Parallels for mac has an idle cpu time of around 2 - 3% and much lower memory usage, so I haven't really spent any time tuning it.

The main idea behind tuning performance is to reduce the unnecessary things that the operating system is doing all the time. You can selectively use these methods and others (just google for many more) depending on what you use and not, and can thus not turn off.

The first thing you can do is turn of aero. Use the Windows Classic or Windows 7 Basic themes for reduced window manager overhead. The window managers on both OS X and Windows 7 are directly affected, if you monitor your cpu usage, these processes are WindowServer and dwm.exe for OS X and Windows 7 respectively. Even though dwm.exe has been greatly improved over the Windows 7 RCs, removing aero can make a big difference especially when using the unity mode, which is what I use. More about the window manager can be found here in this stunning talk by the man himself, link .

You can further tweak the Windows 7 Basic or Windows Classic themes to turn off more effects and further improve performance. These settings can be found in Control Panel -> System -> Advanced system settings -> Advanced (tab) -> Settings (under Performance). I don't personally do this.

We'll go after automatic restore points now. I use my virtual machine only for development and do not really care about this particular feature, my code is always backed up in svn dumps both outside and inside the vm. If I do lose my vm for whatever reason, I can simply create a new one its not hard at all and between installing windows 7 and visual studio takes about 2 hours. This article clearly explains how to go about disabling system restore, link .

Next one can disable Indexing to reduce I/O activity or at least limit it. I turn off indexing all together for User accounts and only let it be on for the Start menu. The settings for the same can be found here, Control Panel -> Indexing Options.

I have my virtual machine set to use 1 GB of ram and 1 processor, with an expanding 80 GB hard disk. While the best thing to do would be to allocate all space for the virtual machine upfront, I do not have enough space for that. The reasoning is that expanding and shrinking drives increase cpu usage. This is most likely to happen if your vm starts swapping. A way around this is to add another hard disk to the virtual machine (I prefer the SCSI type) and make this a fixed size 3 GB disk and assign it to the system as swap. After you have made your disk, in Virtual Machine -> Settings -> Hard Disks (make sure pre-allocate disk space is selected, and split into 2 GB files is off), format this to use ntfs with the disk manager by right clicking the volume (Control Panel -> Administrative Tools -> Computer Management -> Disk Management (under storage) ). Again in Control Panel -> System -> Advanced System Settings -> Advanced Tab -> Settings under Performance -> (again) Advanced Tab -> Change under Virtual memory. Uncheck automatically manage paging file size. With C: drive highlighted select No paging file and press the Set button. With the new 3GB drive selected (E: in my case) select Custom size and write 3000 in both the initial and maximum sizes (this prevents unnecessary growth overhead), again press the Set button.

Thats about all I do, if you do try them especially the swap file one don't blame me if things go wrong; for real. For me though these changes bring down vmware's cpu usage to about 2% when idle, below is a screen shot to prove it.


CPU Usage



Tuesday, 16 February 2010

Attention to detail


Apple is known for its attention to detail (at least in their key applications, the ones that are the focus of the PR machine), for eg: in the timer on an iPod or iPhone try setting the time to 00:00 it silently moves to 00:01. There are numerous other little things you spot here and there when using Apple products and software. I have been using Windows 7 for a while now (as a VM), and I quite like it. I spotted one such thing in Windows 7 today and it really made me smile. Its nice when these little hidden additions make your work a little easier. I was copying a backup dump to my installation when one of my cats managed to dis-lodge the usb cable. Rather than spit out an error of doom, Windows 7 spit out an error with a little button at the bottom which said "Try again". Sure enough I re-connected the disk and the file copy resumed. Awesome.