Every once in a while people will ask why their VM is not performing well.
Well there are many areas where you can look, at the host level, for example by adding more memory to the host or by looking at the guest level. Today, we are going to focus at the guest level and focus in particular on the usage of Page Files in Windows guests.
Page Files for example, are a simple matter. However, you have them at the host level and at the guest level and you don’t want your virtual machines to be writing to the page files all the time as swapping out memory to disk will have a HUGE performance impact.
So what is the first thing you can do to mitigate performance problems? Well you can select a reasonable memory size on your VM so that your memory is not constantly swapped. As a tip normally a good starting point is for windows Vista/2003/2008 is to select 1GB, Windows XP desktops usually do fine around 800MB and resize up or down depending on your needs. Check the Task Manager and verify how much of the page file is being utilised. It is OK that it is being used, memory that is not in constant use, does not have to be in physical memory. Just confirm that your page file usage is not consistantly over the internal memory size as that would indicate memory starvation.
Which brings us to size. I personally prefer to set a Page File size statically to 2x the internal memory. However MS recommended 1.5 times physical memory so you could start at 1.5 times and that should be OK. There are some limits here, for example On a 32bit machine the page file can never be bigger than 4GB. One thing you do NOT want is a dynamically resizing page file, that is the system managed page file and which just happens to be the default. At least it is in Windows XP. It grows and shrinks depending on usage. Great for fragmenting your drives and data on it.
If you get warnings that your page file is too small and that it will be resized, your VM will suffer a huge performance penalty, not only that, your page file will defragment heavily (and all files around it too)
This is the one of the main reason why a windows page file should be placed on a separate virtual disk. So in a Windows XP VM, do add a 2GB extra disk which is used for storing the page file on only. The disadvantage of not having a page file on your system disk, is that you can no longer make crash dumps. The advantages are:
- As your page file is on its own disk, it will no longer fragment
- The files on your other disks will not fragment because of your page file growing/shrinking
- Backups do not have to include the page file disk, it can be regenerated on reboot, you can include a disk with a zeroed out page file for this.
- As the virtual controller now has the page file on another “disk”, it can use another channel. Yes this is in software and speed improvements will be negligable, but its still positive. You can even use another virtual controller by changing the reference in your vmx file from scsi0:2.filename to scsi1:2.filename so you can saturate even more buffers. sarcasm true, but you could do it 😉
- You can now put your page file on another faster spindle if your host has multiple disk systems / spindles
If you still want to be able to make crash dumps then you can also add a small -fixed size- page file on the boot disk of your VM.