Tweaking VMWare Workstation & reducing Disk Thrashing
I use a VMWare virtual machine for development.Â Lately though, I have been having issues with my disk thrashing uncontrollably, slowing everything to a crawl.Â Â This especially seemed to happen right after suspending my VM.Â The disk thrashing seemed to go on for a good 10 minutes before it came back to normal.Â This made my host machine completely unusable during this time.
With the help of DiskMon from Windows Sysinternals, I confirmed that the disk thrashing was being caused by VMWare.Â I did a bunch of research, and came up with the following tweaks that not only fixed my thrashing hard drive issues, but also made the VM generally faster for IO operations.Â I would like to share those tweaks with you here.
My configuration is as follows; but Iâ€™m sure you can apply the same tips with different versions of these software as well:
- Host: Windows 7
- Virtualization Technology: VMWare Workstation 7.1.1
- Guest: Windows 7
Tweak settings in VMWare
Disable â€śTake snapshots in the backgroundâ€ť and â€śRestore snapshots in the backgroundâ€ť in VMWare workstation by clicking Edit –> Preferences. Make sure the following checkboxes are unchecked.
Next, open your specific virtual machineâ€™s settings, then navigate to the Options tab, and click on the Advanced item in the settings list.Â Put a check mark next to â€śDisable memory page trimmingâ€ť.Â This will relieve VMWare from doing extra work, you can find an explanation of this option here.
Create a new Virtual Hard disk dedicated for the Windows Paging File
I chose mine to be about 6000MB or 6GB.Â If you have the luxury of more than one physical drive in your system, it would be even more beneficial to create this virtual disk on a different physical disk, rather than where the virtual machine resides.
When you create this new virtual drive, be sure sure that you choose the option to pre-allocate all the disk space up front.Â In my example I have a 80GB main drive and a 6GB pre-allocated drive.Â VMWare performance will be much better on this kind of a disk.
Next, for the drive you just created, click on the advanced button, and make sure the following settings are set; â€śIndependent Modeâ€ť and â€śPersistentâ€ť.Â Since this drive will only be used for the Windows Paging file, we donâ€™t need to worry about this data being included in snapshots.Â Not having this drive affected by snapshots will have less overhead on the operation of this drive.Â We want the windows paging file to function as fast as possible.
Now power up your virtual machine, open disk manager by clicking START and typing diskmgmt.msc.Â Disk management should see the new disk and ask you if you want to initialize it.Â After initializing it, do a full NTFS format, and assign any available drive letter.Â Once the disk is ready for use, youâ€™ll want to change the location of your Windows Paging file.Â We can do this in the Virtual Memmory settings dialog.
- Click Start
- Right click Computer
- Click Properties
- Click on Advanced System Settings
- Select Advanced tab
- Under Performance click Settings
- Select Advanced tab again
- Under Virtual memory click Change button
Set all the options on this dialog to look like the screen below.Â In this example the B: drive is my swap drive for the paging file, while my C: drive is for windows.Â Â You cannot completely disable the paging file on the windows drive, which is why I have a custom size set for C: to a minimum and max of 200MB.Â After you are finished, windows will ask you to reboot.
After re-starting your guest operating system, hopefully you will have noticed some improvement in speed.Â As for myself, I can say that this has solved my disk thrashing issues.
A further tweaks that you can also apply is to disable the Windows Search Indexing on both the Host and Guest operating system.