Apple, General

Optimizing Parallels virtual machines for .net development

I've been a Mac owner for about a year now – it takes some time getting used to coming from a hard-core Windows mindset. My goal, entering this new stage, was to suck in all the experience possible from the platform and use Windows as little as possible, but being a .net developer, Mono and MonoDevelop does not quite cut it – so Visual Studio is needed to do proper .net development. With my first Mac I had a Boot Camp partition with Windows installed and used Parallels to access the same installation as well. This opened up a can of trouble when going back and forth between Boot Camp and Parallels because of drivers and such, not to mention Parallels services installed. After a while I figured it was probably better to have a dedicated virtual machine existing in a virtual image. 

Several months later, I'm finally content with the speed of my installation. Here are my findings so far.

 

Stripped down Windows
If you're like me, not using Windows for much – in my case I have basically 3 things installed; Visual Studio, SQL Server and SQL Server Management studio, you are probably better off having a stripped down Windows. This can be achieved in many ways. One way is to take a standard Windows installation and start disabling services and removing Windows features. Another way is to get something called TinyXP. TinyXP is a distribution, not from Microsoft, that has most features removed. There is a boot meny were you can chose what you want installed, and the bare minimum does not include internet explorer, mediaplayer or outlook express. Most "nice to have" services are disabled as well. You can also chose to install it without any driverpacks, to keep the size down. For a virtual machine were the hardware is constant, this is probably the best option. TinyXP as mentioned, does not come from Microsoft, so using it is most likely a violation of the license. Instead of using TinyXP, one can use a tool called nLite or vLite if you prefer Vista. The tool allows you to take your existing XP or Vista install CD/DVD and select what features you want to include. When you're done, the tool will create a new installation CD/DVD for you.

I prefer running Windows XP, as it has the basic featureset I need and Visual Studio and all versions of .net runs on it. 

 

SCSI vs IDE
As with all VM software, Parallels also comes with an option of running the harddrive on an emulated IDE or SCSI bus, the default being IDE as this is more compatible and Windows has default drivers for handling this. My experience so far, is that running on SCSI gives a lot better performance, especially using Visual Studio. It doesn't matter what kind of physical disk you're having, you can still use SCSI even if your physical drive is IDE. For Windows XP you can't simply switch to SCSI by default. Windows XP detects the SCSI adapter to be a BusLogic one, and this one will crash during boot. So, the trick would be for instance to set your CDROM to be SCSI and leave your primary harddrive as IDE and then boot into Windows and go to the device manager and install the SCSI driver which is most likely marked with a question mark stating an error with it. The drivers are located on a floppy image located in /Library/Parallels/Tools/drivers.fdd – mount this in Parallels and install the drivers from the mounted floppy inside Windows XP.

 

Parallels options – Optimization
In Parallels 4, there was great improvement to handling OSX caching. By default, OSX will enforce caching for any files used, meaning that your virtual harddrives could potentially eat up a lot of your memory when in use. On the optimization page, you should leave the "optimizate performance for" option on Virtual Machine, and I prefer to use the Adaptive Hypervisor. What this means, is that it will change focus between OSX and your Virtual Machine for utilizing the CPU and other resources. Also worth mentioning is to set the Better Perfomance option and untick the "Enable battery in virtual machine", that ensures full speed-ahead – allthough draining your battery.

Shared Resources
In Parallels there are several producitivity such as shared folders, shared user profile, shared applications, smart mount and such. My experience is that enabling Shared Profile and Shared Applications lags things a bit, so keeping these off will boost performance a bit.

 

CPU
Parallels has the option of virtualization your diffferent cores, you can select how many cores you want to use for your virtual machine. I go with the number of cores I have (which is 2 on my Macbook Pro), there is quite a performance boost by doing so.

 

3D Acceleration + viewmode
One of the neat features of Parallels introduced in Parallels 3 was the ability to support 3D acceleration. This is really nice if you're using any 3D software or playing games, but for doing software development this does not make any sense. In fact, it seems to slow down regular graphics a bit and if you're using software such as Blend or Visual Studio 2010 that relies on WPF (Windows Presentation Foundation), it seems to be even slower. My tip is to leave this off and just allocate enough memory to cope with your screen resolution, typically 16MB should be enough.

Another thing that Parallels comes with is the ability to run in what is called a coherence viewmode. This makes your Windows applications appear as if they are a part of the OSX desktop and they float around like any other OSX window. This is great if you're in a multi monitor environment and want to keep some of your Windows windows on seperate monitors. But, there is a downside, performance wize. I prefer running in fullscreen, even if I run on a multi-monitor setup.

 

Sound, USB
Since my Virtual Machines are primarily there to host Visual Studio, I have chosen to disable both sound and USB. Parallels supports virtualization of USB, meaning that the entire USB hub is available within the Virtual Machine and anything connected to any USB port can potentially be connected directly in the Virtual Machine. If you don't really need these, this is another performance boost.

 

Swap files
This tip is more of a best practice regardless if you're running in a virtual machine or not; have a seperate partition or drive for your swap file(s). In Parallels I've chosen to have a seperate harddisk. This boosts performance quite a bit.

 

Fixed size disks
By default Parallels creates growing disks, this is quite a bit slower than a fixed size disk. Since I have several virtual machines, I create my images with a fixed size and set them to the bare minimum, typically 8 or 10 GB and all my data is on a seperate virtual harddrive that all virtual machines share. 

 

Windows Services
Even if I run on a stripped down Windows, some services are still left on after installation. Manually turning these off will increase performance of the Windows installation and use less memory, some of the services you might find running and might not need are:

* Image acquisition – typically used for scanners and such
* Printing – I don't print from Windows, in fact I never print at all – environmental awareness
* Firewall – I don't need it, I have a firewall on the OSX side already and run in Shared Network mode, besides I never surf the web on my Windows installations

 

Why don't you just buy a Windows machine?
This is a question I get a lot. Well, there is no simple answer. At this point in time, I want to explore different things and don't get locked down. I must admit that the look and feel of Apple hardware is quite appealing as well. 🙂  Even though all of the above research has taken some time to figure out, it has been well worth spending the time. I now have the flexibility I want and can explore multiple operating systems, sure I could just install a "hackintosh" on a Virtual PC or something in Windows on a normal PC. I wanted the real deal and for now I'm content with the situation.

 

There is probably a lot more performance tips out there – I am still digging in my quest to optimize everything to perfection, if you have further tips please leave me a comment. 

Standard
.net, General, WPF

Problem installing programs after installing Visual Studio 2010 beta1?

I'm working on a WPF 4 project, targetting .net 4 and need to use Visual Studio 2010 beta1 for this. For now I've been handcoding all my Xaml (I know, the designer in VS2010 is quite good – but I kinda love doing Xaml), but I wanted to do some more advanced graphics and I am somewhat used to working with Blend for doing that. So I decided to download the Blend 3 Trial and get going. Only thing was that the installer kept saying "Another installation is in progress. You must complete that installation before continuing this one". I downloaded the Windows Installer Cleanup Utility , but it didn't solve anything. In fact, I couldn't install it even, since it was a Windows Installer, had to install it on another computer and copy the files. Tongue out

The event viewer was referring to the 'VSTA_IDE_12590_x86_enu' component and a missing directory. This is a package installed by Visual Studio, called Microsoft Visual Studio for Applications 2.0. 

Turns out, the solution is really simple. Just create the directory and try installing again, in my case I had to reboot and then do the installation of Blend. 

And, by the way, if you want to open your project in Blend 3, you need to change the target framework to something that Blend recognize, 3.5 or less. Read more over at Charles Sterling's blog.For me, I must maintain a seperate .net 3.5 project for my frontend for working with Blend as I am targetting .net 4.

 

Standard
General

New blog design – and move at the same time

Im relaunching myself with a brand new design at a brand new location.

This blog will continue over at the following URL:

For those of you who´ve been subscribing through the Feedburner URL will not notice any outtage, everything has been updated and redirected properly.

If you´re still subscribing to the old RSS link, please update to the Feedburner one above.

Hope you´ll enjoy the new design and keep on reading my ramblings. 🙂

Please leave me a comment if you have any. Also if you feel like your missing something, or you find the design to be ugly or non functional. Any feedback is greatly appreciated.

And now for some credits.

I´ve done the design partially myself. Believe me when I say I´m no graphics artist or designer, so I have to get inspiration and "borrow" ideas from here and there. The top header is ofcourse my own, but the content part is a modified version of the Gluttony WordPress Theme that was adopted to BlogEngine by GravityCube. In addition to this, I´ve gotten the contact actions icons and BlogEngine.net code for using them from David Burke, thanks again for helping me out.

Standard
General, Personal

Wholy Cr…. It’s been a while

Where did time go??

It’s been close to 2 years since my last post..   What happened?    I’ll tell you what happened..   5th of March 2005 I became a dad to a beautiful little girl called Mia. We’re now expecting another baby in May, so I have to hurry up with blogging till then, seeing that I tend to be totally thrown off for a couple of years when having a baby.. 🙂

Standard