Skip to main content

Cloud

SharePoint and Virtual Machine (VM) Performance

As a developer, I live inside my various virtual machines (VMs).  I have at least one VM per project that I’m working on and each VM is rather large (~40GB+).  I use VMs because it makes life easier for me.  It keeps development programs and other non-standard configuration settings off my host machine.  Unlike some developers, I don’t have both a laptop and a desktop/server.  I just have my laptop, which is currently loaded with the following specs:

  • Intel Core i7 M640 (2.8GHz)
  • 8GB RAM
  • 256GB Samsung SSD PM810
  • 500GB WD WD5000BPKT @ 7200RPM
  • NVIDIA GeForce 3100M
  • 1080p LED display
  • VMware Workstation 8.0.2

All of that aside, I often get asked by coworkers why my VMs appear to run so much faster than theirs or how my host machine never seems to have any problems.  The short answer is I have spent a lot of trial and error hunting down the fastest configuration for a VM, specifically a SharePoint VM.  I’ve distilled this knowledge down into a few short principles that anyone can follow.  I’ve also broken down each principle into the type of performance gain you can expect, from major gains to minor gains.  Note: these principles are geared towards SharePoint, but can also be applied to any VM.
Some of these recommendations come straight from VMware’s Performance Best Practices for VMware Workstation, others are based on my own personal experience.  Some may run counter to what VMware suggests, so keep in mind that these settings work for me and are intended as a guide only, not gospel.

Major Performance Gains

These actions will significantly boost performance of your VM, regardless of the specs of your system.  Hopefully most of these will be common sense, but some might not be or maybe you haven’t gone slogging through the VMware settings looking for tweaks.

Run Your VMs Locally

I can’t tell people this enough.  The single largest performance gain you could ever realize is to run your VMs from local hardware installed in your computer.  Don’t run from an external hard drive, even an SSD over eSATA.  It’s always going to be slower.  How much slower obviously depends on a lot of factors, but in general, my local drive always smokes my external drives.  If you have to shuffle VMs around to get one local, I always recommend doing it.  You may lose 30 minutes of productivity, but you’ll be happier when your VM is snappy and responsive.  Plus, you had other stuff to work on, right?

Get an SSD

When I first started at PointBridge/Perficient, my machine had a 7200RPM internal hard drive.  While this isn’t slow, it’s not a Solid State Drive (SSD).  The addition of the SSD to my machine has also dramatically improved performance.  I went from write speeds around 50MB/s to write speeds of 150MB/s.  This translates into a VM that feels and responds like it’s local.

Check Your Memory Location

Did you know that VMware Workstation allows you to specify where you want your VM’s RAM cache to be stored?  By default, it’s set to “Allow some virtual machine memory to be swapped”.  This means that VMware can support VMs with more RAM than your machine has, but it also means that the RAM can be placed in the swap file on the hard disk.  The hard disk is always slower than RAM by an order of magnitude.  A better, though more limiting setting, is “Fit all virtual machine memory into reserved host RAM”.  This will forbid Windows from caching your VM’s RAM file, but it also means that you can’t have total RAM usage across all running VMs larger than the Reserved Memory you’ve specified.
To change this setting, make sure your VMs are paused or powered off and then go to Edit > Preferences and select Memory.  Here, you can change the amount of reserved RAM VMware will attempt to reserve as well as the how VMware will allocate that memory.
image
This gain is offset by having an SSD because performance is comparable to RAM.  But if your VM or Windows swap file is hosted on a spinning disk, it will increase your performance.

Moderate Performance Gains

These actions will lead to significant performance improvements, but nothing that could be considered night and day.

Lower Your VM’s RAM Usage

Microsoft’s recommendation for a developer machine running SharePoint is 4GB of RAM.  This is a lot of RAM, and over half of the RAM on most people’s machines.  However, this recommendation is for a machine that has every Shared Service Application (SSA) enabled and is shared across users.  Your personal development machine is unlikely to be shared and probably won’t have all of the Shared Service Applications enabled (see below).
I usually run my SharePoint VMs with 2GB of RAM.  This includes SQL, SharePoint, Active Directory, and Visual Studio Ultimate.  In general, there isn’t a performance lag.  If I have to turn on additional SSAs, FAST Search, or additional SQL roles (i.e. Reporting, Analytics, etc.) then I’ll bump it by 512MB for each item.
This principle seems counter-intuitive, but keep in mind that you need to balance performance across your local host and your VM.  This principle is best combined with the other Moderate gains.
Note: Microsoft’s minimum system requirements mandate 4GB of RAM for SharePoint.  You may be required to increase the memory allocation if you call Microsoft support.

Change Your VM’s Processor Usage

Processor usage is called affinity.  It pertains to how the operating system splits threads across multiple CPU cores.  On my machine, I have a dual-core hyper-threaded processor.  VMware offers two options for Processor choice: Number of processors and Number of cores per processor.  The image below is for my Windows Server 8 VM.
image
Naturally, you’d think, that a dual-core hyper-threaded processor is two cores. You would be wrong because of how VMware deals with affinity.  VMware treats Number of processors as separate internal processes while Number of cores per processor simply serves as a multiplier for the number of threads for the process.  Thus, choosing 2 processors results in my VMs consuming 100% of the CPU on my machine, while choosing 2 cores results in only 50% of the CPU being used.

Kill the Bloat

When people install things, especially server software, they tend to not understand everything that the software needs installed to do what they want it to do.  For example, SQL server does not need SQL Books Online to function properly, nor does SharePoint require you to follow the Farm Configuration Wizard on Central Administration.  While using the default installers makes life easier for the novice, it also leads to a lot of bloat both in used hard disk space and resources.
The simple solution is to kill the bloat.  If you’re not using SQL Analysis Services or SQL Reporting Services, uninstall it.  Likewise with various SharePoint SSAs and non-essential Visual Studio or Office elements.  If you don’t program in VB or C++, don’t install them.  If you’re not going to need Outlook or Visio or PowerPoint on your VM, don’t install it.
The downside to this approach is that you may miss something you need later, but you can always always install what you missed later.  Not only does this keep the size of your VM down, but it keeps performance sapping programs from running when you don’t need them.

Minor Performance Improvements

These changes will provide relatively minor performance improvements to your VM.  Collectively, they don’t make a big difference, but they can be the difference between a system that seems responsive and one that feels less so.

Pause Instead of Shut Down

Depending on your hardware, pausing your VM could save you significant time over shutting it down.  On my machine with my SSD, pausing takes a matter of seconds while shutting down comes with the added pain of starting up.  Plus, I don’t have to save everything when I pause a VM.  I can leave it in that paused state for days, weeks, or months and it’ll come back like normal.

Install the Latest VMware Tools

VMware Workstation includes an install for your VM that enables copy-paste, dynamic resizing, and a host of other drivers for your VM to make it seem like an extension of your desktop.  If you don’t install it, you’ll miss out on a significant amount of performance enhancements that make your VM run faster.  For newer Windows OSes (Windows Vista/2K8 and newer), VMware Tools will tell Windows it’s running in a VM.  This eases licensing requirements and also improves performance.
With every update to VMware Workstation, there’s a new version of VMware Tools.  This is a blessing and a curse.  It’s great because you get updates that make your VM integrate with VMware better, but it’s a curse because you have to restart your VM after the install.  However, don’t stick with the old version!  Those changes in VMware Tools weren’t just to the version number and can actually improve performance.

Disable Memory Page Trimming and Sharing

Memory Page Trimming and Memory Page Sharing are techniques that VMware uses to minimize the size of VMs in memory.  If you’re running multiple VMs or have multiple users logged into a single VM, Memory Page Sharing identifies pages that are duplicates and eliminates them.  This saves on RAM size, but it means that whenever a page is invalidated it must be duplicated in RAM before it can be changed.  This can lead to a significant performance hit.  Therefore, if you have the RAM available, you can safely disable this feature.  Memory Page Sharing deallocates lightly used pages from memory and puts them in the swap.
To disable Memory Page Trimming, go to VM > Settings… then select the Options tab and the Advanced section.  Then check Disable memory page trimming.
image
To disable Memory Page Sharing, you must edit the VM’s .vmx file and add the line sched.mem.pshare.enable = “FALSE”.

Disable Debugging

VMware supports debugging to be used later.  Turning debugging off is when your machine will run fastest.  To disable debugging, go to VM > Settings and select Advanced under the Options tab then set Gather debugging information to None.

Eliminate Snapshots

Snapshots in VMware and other hypervisors provide you with the capability to roll back to a previous state.  This is a great feature if you get in a pickle or your VM somehow gets corrupted.  However, it’s a drag on performance, especially multiple snapshots.  When you start or resume a VM, the snapshots must be squashed into a single representative file structure for the guest operating system to function correctly.  So if you don’t intend to go back to your previous snapshot(s), delete them.

Pre-Allocate Hard Drive Space

When you create a new virtual hard disk, by default it begins as an auto-expanding file.  This saves space, but requires resources on the host to expand the size of the file as it grows.  You can eliminate the need for these resources by pre-allocating space for your virtual hard drives.  This is an option when you create the virtual hard disk.  If you’ve already got a virtual hard disk that isn’t pre-allocated, you can’t pre-allocate the space for it after it’s been created.

Set VM Priority to High

VMware provides the ability to set the priority level for individual VMs as well as the default priority level for all VMs from the settings menu.  This sets the priority for the VMs process in the host operating system.  The options for the active VM are Default and High.  Likewise, you can set the priority for a VM that is running in the background.  These options are Default and Low.  I prefer High for my active VM and Default for my backgrounded VMs so they don’t starve.

Update VMware

Occasionally, VMware will release updates to the software to support new operating systems like Windows 8.  These updates also include performance and other bug fixes.  Moreover, the updates are free, and, with VMware Workstation 8, don’t require a restart.  So the only reason not to upgrade is because you have a phobia of upgrading.  Its simple and automatic.

Install the Latest Drivers for Your Host

Similar to updating VMware Workstation, make sure that you have the latest drives for your host’s hardware.  If you use the default Windows drivers, these often are generic and won’t tap into all of the capabilities of your hardware.  You could miss out on virtualization support built into your graphics card, hard drive, and network card.  As an example, the default Windows drivers for my NVIDIA GeForce 3100M don’t support more than one monitor at 1080p or virtualization, but the NVIDIA drivers do.  Sometimes Windows will grab the right driver, but in general it tends to stick with a generic driver written by Microsoft.

Run Windows Update Manually

This last principle deals more with unnecessary surprises in your VM.  Never set your VM to install Windows updates automatically.  Since it’s unlikely that you’ve customized your power settings on your VM, it’s likely that it will download and install updates during the workday.  Moreover, the default idle timeout for a restart is 15 minutes.  So if you go to lunch, your VM could restart before you get back and you could lose all of your unsaved work.

Conclusion

There’s a lot of performance that can be eked out of VMware and your underlying hardware as is, without the need for a more expensive platform.  Some of these principles do necessitate upgrades, like getting an SSD.  In general, these principles apply to all sorts of VMs, not just SharePoint ones.  However, I spend the vast majority of my time dealing with SharePoint VMs.
What experiences have you had and if you have any further tips for improving performance or a bad experience with a recommendation, let me know!

Thoughts on “SharePoint and Virtual Machine (VM) Performance”

  1. Pingback: SharePoint and Virtual Machine (VM) Performance | Microsoft NSI … | Mastering Sharepoint

  2. Pingback: SharePoint 2013 VM Guidance | Microsoft Enterprise Technologies

  3. Hey there, this really is completely new for me even so I find your web log and it’s material a big benefit in understanding the overall stuff. I wish that I discover much more useful resources on my next visit.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Andrew Schwenker

Andrew Schwenker is a Sr. Technical Consultant within Perficient’s Microsoft National Business Unit East's SharePoint practice. Andrew has nearly 2 years of experience in consulting and has participated in projects that have touched nearly every aspect of SharePoint 2010. Andrew earned his Bachelor’s degree in Computer Science as well as Master’s degrees in Computer Science and Information Systems from Indiana University. He’s interested in creating winning solutions to generate business innovation using SharePoint. Prior to starting at Perficient, Andrew completed internships with General Electric, ExactTarget, and Great American Financial Resources. During his studies, he actively participated in Alpha Phi Omega National Service Fraternity and competed in the first annual Cluster Challenge at SC07 in Reno, NV. Andrew was a part of the dynamic PointBridge team that was acquired by Perficient.

More from this Author

Follow Us
TwitterLinkedinFacebookYoutubeInstagram