http://social.technet.microsoft.com/wiki/contents/articles/7926.sharepoint-2010-tips-for-dealing-with-performance-issues.aspx

http://www.aptimize.com/upload/docs/sharepoint-performance-optimization-10-steps.pdf

How to tune SharePoint 2010 Server for better performance?

 
What?
 
How to tune SharePoint 2010 Server for better performance?
 
Why?
 
SharePoint has an array of areas where performance is an issue and bottlenecks occur. It is particularly important for public web sites, but Intranet sites & collaborative sites benefit from this as well. In this post we will learn how to tune SharePoint 2010 for better performance.
How?
 
Before you even start thinking about improving your performance, keep in mind that even the best configuration won’t help you if your hardware is simply too weak to handle the SharePoint environment. 
 
SharePoint is very memory intensive. Always plan for fast network cards and plenty of RAM! It is very important that the server achieve the fastest response possible from the I/O subsystem. More and faster disks or arrays provide sufficient I/O operations per second (IOPS) while maintaining low latency and queuing on all disks.
 
In this post we will look at the below:
  • Infrastructure Optimization
  • Database Optimization
  • Caching
  • Server Optimization
  • Page Optimization
  • Other Considerations

Infrastructure Optimization:
 
Search in SharePoint is very memory intensive. It is often the first source of performance headaches.
 
The better the links to the database are optimized, the better the overall performance will be.
 
If all the servers (front-end servers and application servers) are behind the same switch, the application servers that run search will be going out through the switch each time an incremental crawl is kicked off.  
 
Below is an example diagram of an undesirable topography:
 
 
 Try to separate front-end user traffic from back-end SQL traffic.
 
Front-end servers should talk to the SQL server(s) through one network and application servers & AD talk to SQL server(s) though a different network. 
Below is a diagram of the desired topography:

Even better, set aside an index server in the farm and let it crawl itself without having to take traffic across the front-end servers, as shown below:

In addition to search, publishing sites require a lot of memory as the number of read operations will be 100-1000 times greater than write operations. ECM sites require more application servers as there will be a lot of back and forth talk between them.

 
Try to distribute your service applications across multiple application servers whenever possible.

Database Optimization:

Database Operations:

Different things in SharePoint have different effects on the databases.
Order of items by their impact (1 being the biggest killer whereas 10 has the least impact):
  1. Performance Point Services
  2. Search
  3. Content Query
  4. Security Trimming (SPSecurityTrimmedControl delegate)
  5. Collaboration
  6. Workflow
  7. Publishing
  8. Social
  9. Client Access
  10. Browsing
What is the impact of custom code? It depends on the quality of the code.

Database Size:

Even though Microsoft says that each content database can hold up to 4 TB, the recommended practical limit is 200 GB for easily manageable backup and restores.

Analytics databases grow very quickly to very large sizes. Try to isolate Analytics databases. Analytics reports can have significant impact on CPU load.
Search uses multiple databases for its operations. It uses separate databases for crawl, properties and administration. Crawl databases can be extremely large. Crawl databases also have heavy transactional volumes. Try to isolate temp and crawl databases if possible.
Database Management:

Performing the below steps at the database might result in better performance:

  • Manually configure auto-growth settings. The default auto-growth setting in SQL Server is 1 MB. Set it to 100MB / 200 MB depending on your environment. This allows the database to grow in larger chunks, which is more efficient since these databases tend to grow rapidly.
  • Defragment database indexes regularly.
  • Limit content DB size per site collection.
  • Isolate transaction logs by writing them off onto separate disks.
  • Enforce site collection quotas in Central Administration.

Caching:

Make sure that all the custom controls / web parts use caching.
I have build and contributed a framework for custom web parts out in Codeplex.
It is available here: http://asyncwebpartframewrk.codeplex.com/.
Web parts that are built using this framework will make use of caching and asynchronous loading of data into the web part after the page is loaded.
SharePoint supports the following types of cache:
  1. BLOB Cache
  2. Output Cache
  3. Object Cache
  4. Branch Cache
BLOB Cache:
 
BLOB Cache/Disk-based caching controls caching for binary large objects (BLOBs) such as image, sound, video, and some static content files like CSS. Disk-based caching is fast. It eliminates the need for database round trips. BLOBs are retrieved from the database once and stored on the Web client. Further requests are served from the cache and trimmed based on security. 
BLOB Cache needs to be enabled from Web.Config. Make sure that there is enough space in the drive/server where blob cache is stored. It’s important to understand that BLOB cache is per-machine. So make sure that the BLOB cache settings are consistent across the whole farm. You don’t want one server with 1 GB of BLOB cache and another server with 4 GB of BLOB cache. You might see strange and inconsistency in performance if you don’t configure BLOB cache consistently.
 
By default, the disk-based BLOB cache is off and must be enabled on the front-end Web server. In order to enable BLOB cache, locate the Web.Config for the web application and edit it. The recommended approach for making such changes in Web.Config file is through a feature receiver or PowerShell by making use of SharePoint’s SPWebConfigModification class.
 
In the Web.Config file, find the following line: 
 
<BlobCache location="" path="\.(gif|jpg|jpeg|jpe|jfif|bmp|dib|tif|tiff|ico|png|wdp|hdp|css|js|asf|avi|flv|m4v|mov|mp3|mp4|mpeg|mpg|rm|rmvb|wma|wmv)$" maxSize="10" enabled="false" />
 
In this line, change the location attribute to specify a directory that has enough space to accommodate the cache size.
 
We strongly recommend that you specify a directory that is not on the same drive as where either the server operating system swap files or server log files are stored.
 
To add or remove file types from the list of file types to be cached, for the path attribute, modify the regular expression to include or remove the appropriate file extension. If you add file extensions, make sure to separate each file type with a pipe (|), as shown in this line of code.
 
To change the size of the cache, type a new number for maxSize. The size is expressed in gigabytes (GB), and 10 GB is the default. It is recommended that you not set the cache size smaller than 10 GB. When you set the cache size, make sure to specify a number large enough to provide a buffer at least 20 percent bigger than the estimated size of the content that will be stored in the cache.
 
To enable the BLOB cache, change the enabled attribute, from "false" to "true".
 
You can use an STSADM command to flush all BLOB caches associated with a specified Web application on different Web front-end computers on the farm: 
 
stsadm –o setproperty –propertyname blobcacheflushcount –propertyvalue 11 –url http://mywebapp::port
 
Output Cache:
 
Output cache requires publishing infrastructure. It is specifically geared more towards publishing portals. HTML pages are written into memory and served from memory as opposed to serving them from databases. Watch out for authoring experience! If output cache is set in an authoring environment, authors may not see their changes until the cache expires. Similarly, make sure to not output cache search results.
Object Cache:
 
Object Cache is used in custom code. This is especially useful when the content that is served does not change quite often. It is extremely important to make sure that you cache and serve data appropriately to users based on their permissions when using object cache. You don’t want a user with insufficient privileges to be able to access data that he/she is not supposed to access just because the custom code has cached the data incorrectly without giving enough consideration to the permission levels.
 
Branch Cache:
 
Branch Cache is a feature within Windows 2008 R2 / Windows 7 Enterprise & Ultimate that allows you to pull documents from the network and cache them locally. Branch Cache improves performance of applications that use HTTP, HTTPS, as well as SMB (the protocol used for shared folders) and WebDav (an extension of HTTP). Because SharePoint uses these protocols, it is able to take advantage of Branch Cache. Just remember that clients must be using Windows 7 and Windows 2008 Server for it to work.
 
In order to enable cache for a site collection, navigate to the site collection settings page and then scroll down to the section “Site Collection Administration”.

As highlighted in the above screenshot, you can configure Object & Output cache from SharePoint UI.
 
Enable Output Cache, Object Cache & Cache Profiles on each SharePoint site collection. Enabling blob & output cache improves the site performance by 50-60%.
 
Server Optimization

IIS Compression:

IIS Compression is turned on by default in Windows Server 2008. An important thing to note is that it is just enabled but not configured.  IIS Compression takes all the objects in the site, compresses them and delivers them as smaller packages to the clients.  It can be configured to be set at a level between 0 and 9. By default, it is set to 0 when it is turned on. 9 means lot of pressure on CPU utilization.  We recommend it being set to 6/7/8/9 depending upon your hardware.

IIS Compression wont effect dynamic content such as web parts like Content Query Web Part etc. Just like blob & output cache it can only compress static content.  Depending on the level of compression set, page size will be reduced by 30% - 40%.

IIS Compression is only enabled but not configured. If you want to make sure that it is enabled, fire open IIS Manager and choose a site.  Click on the button “Compression” as shown in the screenshot below:

IIS Compression needs to be configured through command prompt using the following scripts. (The below script sets the levels to 9)

%windir%\system32\inetsrv\appcmd.exe set config /section:httpCompression –[name=’gzip’].dynamicCompressionLevel:9

%windir%\system32\inetsrv\appcmd.exe set config /section:httpCompression –[name=’gzip’].staticCompressionLevel:9
Resource Throttling & Locks:

By default, resource throttling is set to 5000 items (You can have up to 20,000).  SQL Server by default locks the table when it executes a query that returns more than 5000 records from a record set.  You can change the 5000 item limit in Central Admin depending on your environment and requirements, but this is not recommended.

Instead, consider enabling bit rate throttling.  Bit rate throttling controls download speeds of large objects like Flash, Silverlight, videos, etc. by limiting the amount of bandwidth that can be used for streaming.
To enable bit rate throttling:
Navigate to Central Admin > Application Management > Manage Web Applications

Choose the desired web application and click on the button “General Settings” in the ribbon. In the drop down click on “Resource Throttling”

Enabling object model override allows custom code to be able to retrieve more than 5000 items at a time.

HTTP Request Throttling, which is on by default, monitors front-end server performance and in the event of HTTP request overload, rejects low priority requests when the threshold is reached. This is particularly useful for public facing web sites where there are more chances for DDOS kind of attacks.


Page Optimization:

Optimize Pages:

SharePoint pages contain lot of resources; these can include but are not limited to:

  • JavaScript Files
  • CSS Files
  • Navigation Controls
  • Menus
  • Web Parts
  • Custom Controls
  • Ribbon Control
  • Delegates
  • SPSecurityTrimmedControls
  • Publishing Fields
  • Search Controls
  • Hidden Controls
Customized pages (unghosted pages as they are called in earlier versions) may be easy to develop but they are bad in performance. However, The advantage with customized pages is that they can be created and modified using SharePoint Designer.  When a page is customized in SharePoint and saved, it will no longer be served from file system. Instead a copy of the page will be written into the database and from there on whenever the page is requested, it will be retrieved dynamically from the database.

Un-customized pages (ghosted pages) are always loaded from the file system. Thus they take advantage of blog cache and output cache. Thus, they load faster and perform better.  There is a noticeable 10% - 30% performance difference between customized and un-customized pages.  In order to create un-customized page layouts or master pages, you will have to develop solutions using Visual Studio 2010 that will deploy them to /_layouts/ folder in 14 hive.
In addition to pulling all the content from databases, all the customized pages will have to run through safe mode parser. Safe mode parser is a control that resides in each customized page and watches for inline scripts. Anything that comes out of the database has to run through the safe mode parser.
ASP.NET parses a page on first render and compiles it into an assembly. The safe mode parser does NOT compile pages. It is designed to interpretatively parse a page and create the object structure of the page. In the event inline server-side code is detected, the safe mode parser will not allow the page to render. Additionally, the only objects within the page (i.e. controls marked as runat=’server’) which can be instantiated are those items found in the SafeControls list in Web.Config.
Optimize Branding:

I advise you start building master pages from minimal.master.  This is a much cleaner starting point that will remove much of the unnecessary items in standard master pages.  Consolidate all the CSS & JavaScript files and try to minify the JavaScript files so that the browser does not have to make multiple requests for multiple CSS/JS files.  Additionally, Use image stitching on pages with lots of small images to reduce the number of requests.
It is also recommended that all the resources such as style sheets, master pages, page layouts, images, JavaScript files, etc are stored on file system (i.e. /_layouts/ folder in 14 hive) not in the virtual file system within your site (Style Library, Publishing Images etc…). To achieve this, you will have to develop solutions using Visual Studio 2010 that will deploy them to /_layouts/ folder in 14 hive.
Also consider referencing files like jQuery.js, etc.. from Content Delivery Networks. Many of them allow you to link to their copies of the files.  Often times, you can Use CDN—for example the Google AJAX Libraries content delivery network—to serve JQuery to your users directly from Google’s network of data centers. Doing so has several advantages over hosting JQuery on your server(s): decreased latency, increased parallelism, and better caching.
Just because a SharePoint list can hold millions of items does not mean it should.  All user content in all lists throughout the entire site collection is stored in a single table in content database. Scary!!  The more the number of items, the slower the site will be. Consider partitioning the data into multiple site collections.
Even though list view web parts are improved in SharePoint 2010 and are XSLT based, they are still bad on performance with large data sets. XSLT is not particularly fast when there are large datasets. That is due to the large amount of looping that it needs to do to the xml that is returned. So consider developing custom controls with good caching mechanisms if you need to render large datasets to your users.
Wake up SharePoint 2010 Every Day:
Avoid that COLD, SLOW request that baffles users. Use a simple application called SPWakeUp.exe found here that touches each site and site collection on your SharePoint server to rebuild the IIS cache. Use Windows Task Scheduler to run this application once a day usually at around 4:00 AM.
Asynchronously Load Web Parts / Controls:

If you have XSLT List View Web Parts / Search Results Web Parts for displaying list data or aggregated data, SharePoint 2010 allows you to load the web part data asynchronously after the page is loaded. To enable asynchronous loading, edit the web part and in the editor part, navigate to the AJAX Options section and check the option “Enable Asynchronous Load”.

You can also enable asynchronous loading for Content Query Web Part as well. Unfortunately it is not so straight forward. I have explained how to do that in this post


Other Considerations:

List Definitions:

Plan list schemas, list and library limits well in advance. If a list definition consists of more columns of a particular type than the recommended number of columns, it results in row wrapping.

Column limits:

It is widely known that SharePoint Server 2010 data is stored in SQL Server tables. To allow for the maximum number of possible columns in a SharePoint list, SharePoint Server will create several rows in the database when data will not fit on a single row. This is called row wrapping.
Each time that a row is wrapped in SQL Server, an additional query load is put on the server when that item is queried because a SQL join must be included in the query. To prevent too much load, by default a maximum of six SQL Server rows are allowed for a SharePoint item. This limit leads to a particular limitation on the number of columns of each type that can be included in a SharePoint list. The article at this URL describes all the column limits: http://technet.microsoft.com/en-us/library/cc262787.aspx#Column
The row wrapping parameter can be increased beyond six, but this may result in too much load on the server. Performance testing is recommended before exceeding this limit.  Be careful—SQL row wrapping can degrade the performance by 35%.

Developer Dashboard:

Developer dashboard provides metrics on object execution for individual pages.  Turning on developer dashboard can be done in code or with PowerShell.

Wictor Wilen created a solution that can be used for configuring developer dashboard through UI. http://www.wictorwilen.se/Post/SharePoint-2010-Developer-Dashboard-configuration-feature.aspx
Timer Job Separation:

You can take some jobs and pin them to a content database which is running in a different farm or a different environment. So that load is off the server.
Finally many thanks to Eric Shupps for his wonderful demonstration at SharePoint Conference 2011. He inspired me to share this wealth of information that I learned from him. Eric can be found at http://www.binarywave.com/blogs/eshupps/default.aspx
Additional Resources:

SharePoint Server 2010 Capacity Management: Software Boundaries and Limits
Capacity Management and Sizing Overview for SharePoint Server 2010
Capacity Planning for SharePoint Server 2010
Performance Testing for SharePoint Server 2010
Storage and SQL Server Capacity Planning and Configuration
Performance and Capacity Technical Case Studies
Monitoring and Maintaining SharePoint Server 2010
Performance Testing for SharePoint Server 2010
 

How to tune SharePoint 2010 Server for better performance?的更多相关文章

  1. 自定义和扩展 SharePoint 2010 Server 功能区

    了解构成 SharePoint 2010 服务器功能区的组件以及如何通过演练两个功能区自定义项方案来自定义功能区. 适用范围: Microsoft SharePoint Foundation 2010 ...

  2. RBS SharePoint 2010 Server.wmv

    视频地址: https://www.youtube.com/watch?v=DXi2er514iA&feature=youtu.be

  3. 【SharePoint 2010】将Sharepoint Server 2010部署到WINDOWS 7

    1.部署-安装环境: 在这里先说明一下:2007的版本中我们只能装在WINDOWS 2003 SERVER 上,这种限制在2010被彻底打破了.我们可以将它安装在VISTA/WINDOWS 7/SER ...

  4. [原] SharePoint 2010 WebPart与Google地图系列 一:创建显示地图的WebPart

    摘要: 作为信息化先驱的产品SharePoint 2010竟然对GIS相关技术支持如此有限,试问现在哪个企业没有大量的项目需要结合Google地图来进行开发,单纯地从Google Javascript ...

  5. SharePoint 2010 文档管理之过期归档工具

    前言:使用过SharePoint的人都知道,SharePoint对于操作是便捷的,但是对于数据量承载却是不令人满意的,这样,就要求我们需要更加合理的使用,规范大家的使用规则和习惯,所以,定期清理不必要 ...

  6. 转载-SharePoint 2010 WebPart与Google地图系列 一:创建显示地图的WebPart

    [原] SharePoint 2010 WebPart与Google地图系列 一:创建显示地图的WebPart 摘要: 作为信息化先驱的产品SharePoint 2010竟然对GIS相关技术支持如此有 ...

  7. 在 Windows Vista、Windows 7 和 Windows Server 2008 上设置 SharePoint 2010 开发环境

    适用范围: SharePoint Foundation 2010 | SharePoint Server 2010 本文内容 步骤 1:选择和预配置操作系统 步骤 2:安装 SharePoint 20 ...

  8. 清理SharePoint 2010的SQL Server 2008 R2日志数据库的方法!

    //来源:http://www.cnblogs.com/nbpowerboy/p/3380079.html 公司用SharePoint 2010已有三年多的时间了,上BPM项目也有2年多的时间,之前供 ...

  9. 在SharePoint 2010中,如何找回丢失的服务账号(Service Account)密码

    背景信息: 通常在SharePoint环境中我们会使用很多的服务账号来运行各种不同的服务,尤其在企业环境中,由于权限管理条例严格,这些服务账号更是只能多不能少.面对如此多的服务账号,各个企业都会有自己 ...

随机推荐

  1. 分页控件(PageControl)的相关属性说明

    UIPageControl *pageControl = [[UIPageControl alloc] init]; pageControl.center = CGPointMake(w * ); p ...

  2. 数据库知识(主要基于Oracle,Sql可参考)

    1.关于Union的知识 select 11 from dual union select 11 from dual 和 select 11 from dual union all select 11 ...

  3. char*,const char*和string 三者转换

    1. const char* 和string 转换 (1) const char*转换为 string,直接赋值即可. EX: const char* tmp = "tsinghua&quo ...

  4. linux 用户打开进程数和文件数调整

    1 查看nproc(max user processes)命令 [root@vm-cdh4 ~]# ulimit -u 14866 2 修改nproc 临时修改, 重登录或重启后失效: [root@v ...

  5. MySQL之学生名次问题

    --对输入的数据进行约束create table t(studentID char(10), [name] varchar(8), startDate char(10) Check (isdate(s ...

  6. Jmail发送邮件与带附件乱码解决办法

    Jamil发送邮件的具体用法: 首先,我们要从网上下载Jamil.dll的组件,这个网上很多,然后添加引用using jmail,然后再本机或者服务器上注册一下 将jmail.dll拷贝到服务器的sy ...

  7. (转)LR监控Linux系统性能计数器详解

    从LR里面add measurement,填写linux机器的IP,出现所有unix/linux的计数器,包括cpu的,mem的,disk,network的.这里介绍几个常用的: (对于如何监控Lin ...

  8. Codevs 2875 RY哥查字典

    时间限制: 1 s  空间限制: 16000 KB  题目等级 : 钻石 Diamond  题目描述 Description RY哥最近新买了一本字典,他十分高兴,因为这上面的单词都十分的和谐,他天天 ...

  9. Makefile中=、:=、+=、?=的区别

    =,就是基本的赋值 :=,覆盖原来的值 +=,添加新值 ?=,如果没有赋值则赋值

  10. OLE-Excel基本操作

    1.create object  obj   CREATE OBJECT EXCEL 'Excel.Application'. 这个obj通常指能够支持的应用程序 应用程序首先要满足OLE2的标准 同 ...