Creating an optimized SharePoint development environment was not an easy task with Sharepoint 2007, but it’s even harder with the new SharePoint 2010. The new version has a lot more features but, because of that, it’s also much more resource demanding, and that will make you sweat when building a new virtual machine to perform well on a laptop.
Following Raul’s post on SharePoint 2010 Tips for Performance, and because there seems to be a lot of people in the community facing the same issues I have, I’ll be describing in this article some recommendations and best practices that I’ve been collecting here and there.
Some of these recommendations apply not only to development virtual machines, but also to non virtualized production servers.
Creating the Virtual Machine
When creating the virtual machine, you should take the following hardware requirements into account:
- Allow your virtual machine to use all CPU cores available in the host
- Allow your virtual machine, at least, 4GB of RAM
- Place your virtual machine in the fastest hard drive of the computer
- Use e-Sata external drives because USB 2.0 and FireWire are too slow
- Use 7200 RPM drives or, ideally, SSD drives
To avoid waste of resources, configure your VM and turn off everything you don’t need:
- CD Drive
- USB Support
- Printer Support
Additionally, access the BIOS for the VM and disable the serial and parallel ports.
Optimizing the Operating System
The operating system to use is Windows Server 2008 R2 64-bits. The standard edition is enough for a development environment, but be sure to check out the other versions in case you need some feature that is only present in the enterprise version.
In a development environment, there are several optimizations that can help you free some resources:
- In the network configuration options, uninstall the QoS Packet Scheduler and the Link Layer Topology Discovery components, and uncheck IPv6.
- Turn off the Windows Firewall.
- In the Computer properties > Advanced > Performance Options > Visual Effects, select the option Adjust for best performance.
- In the Control Panel > Hardware > Sound, don’t turn on the Windows Audio Service and select No Sounds as the Sound Scheme.
- Turn off IE ESC for both administrators and users
The pagefile is also a possible optimization target:
- If possible, place it in a disk different from the OS disk
- Define the pagefile initial dimension to be the amount of RAM of the machine, and the final dimension to be the triple of the amount of RAM of the machine (if you have enough disk space)
Whenever possible, it is a good idea to defragment the disks before shutting down the machine (this also applies to the host machine).
Optimizing SQL Server
SQL Server is where SharePoint stores all the data and, for that reason, is one of the main causes of the high resource consumption. You should use SQL Server 2008 64-bits SP1 with CU2 (or higher) or, ideally, SQL Server 2008 R2 64-bits. The important thing here is that it’s Enterprise or Developer edition.
One of the main optimization points for SQL Server is storage, that is, disk performance. To assure the best possible performance, you should create additional virtual disks so that you can separate in different disks:
- SQL Server’s TempDB
- Database data files (.mdf e .ldf)
- Database log files (.ldf)
These disks should have the following characteristics:
- Single file
- Pre-allocated size
- NTFS Formatted using 64K blocks
Ideally, each of these virtual disks should be stored in a distinct physical disk, but when you intend to use the virtual machine in a laptop, it’s not easy to carry 3 or more external hard drives in your backpack.
Anyway, even if you don’t have enough physical hard drives, the virtual disks should be stored in physical disks according to their speed, using the following order:
- TempDB disk (fastest)
- Log file disk
- Data file disk
- System disk (slowest)
By default, SQL Server specifies small sizes for the data files and uses small auto-growth sizes to save disk space. However, the auto-growth operation as well as the fact that they grow in small blocks, causes performance degradation as well as fragmentation of the files in the disk.
To increase the performance you should:
- Use more than one data file in the primary file group for the TempDB, search DBs and content DBs of SharPoint.
- Always use, at most, one data file for each CPU core of the system. Ideally, you should use one data file for each 2 CPU cores.
- If possible, store the data files in different physical disks (very hard for a development environment).
- Pre-allocate all data files, including the data files for TempDB.
- The data files for each DB should be equally sized.
- Specify a size for the data files that is enough to avoid auto-growth (for the TempDB, the total size should be 10% of the total size of the largest DB of the system).
- Specify data file growth size to be 256MB or 512MB
Lock Pages in Memory
Another important configuration, is to authorize SQL Server to use the Lock Pages in Memory feature to keep Windows from unloading the memory pages that might still be needed, leading to a performance degradation (more information in: http://support.microsoft.com/kb/918483).
Use SharePoint’s complete installation, instead of the stand alone installation, so that it doesn’t install a new SQL Server instance or automatically configures the Farm.
After the installation, configure SharePoint turning on only the features that you absolutely need. Each unnecessary service you turn on will mean less memory and CPU time available for the services that really matter.