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. 深入浅出ExtJS 第四章 表单与输入控件

    4.1 制作表单 var form = new Ext.form.FormPanel({ title:'form', defaultType:'textfield', buttonAlign:'cen ...

  2. DWZ(JUI) 教程 中如何整合第三方jQuery插件

    Query插件一般是$(document).ready()中初始化 $(document).ready(function(){  // 文档就绪,初始化jQuery插件| });  // 或者或缩写形 ...

  3. view, surfaceView, invalidate, postInvalidate, 刷新屏幕

    http://blog.csdn.net/linghu_java/article/details/9985489 1.view view在api中的结构 Java.lang.Object Androi ...

  4. iOS定位 (一) 地图定位

    带地图的定位方法#import <CoreLocation/CoreLocation.h> #import <MapKit/MapKit.h> <MKMapViewDel ...

  5. c# SQL CLR 之一

    CLR就是公共运行时,本文就对c#编写SQL StoredProcedures的过程进行简单讲解. [步骤] 2. 3. 7.打开设置 8. 注意删除方式:注意删除Assembly时,一定要先把引用此 ...

  6. JAVA:数组,排序,查找<4>

    一.数组 1.一维数组 (1).数组的定义 数据类型 数组名[]=new 数据类型[大小] public class Demo1 { public static void main(String[] ...

  7. javascript笔记——jquery.each中使用continue和break的方式

    jQuery.each中continue的方式是 return  true  break 的方式是return false

  8. Shell指令

    Shell指令 1.Shell原理图 2.Shell指令的基本语法 Shell指令 Shell –选项 参数 Shell –选项 Shell参数 3.常用的Shell指令 1)ls指令:显示文件信息 ...

  9. ubuntu 14.04 下FTP服务器的搭建--锁定用户目录,解决vsftpd: refusing to run with writable root inside chroot()

    FTP服务器的搭建,我要实现的需求是: 不允许匿名访问,因为我的机器不想让谁都能登录上来,随便获取文件, 需要锁定一个目录,因为在家里,我需要给媳妇下载一些电影 韩剧之类的东西,媳妇会来我机器下载,但 ...

  10. javascript "\" 在字符串里的是转义的意思

    "\n" 在字符串里是换行的意思 alert("dfdsad\ndfsdf");   //有换行 alert("abc\de");   // ...