Introduction
Implementing caching can substantially improve page performance. There are fundamentally two kinds: browser-based and server-based. Browser-based involves the user's browser storing pages and page components (eg, js files, image files, applets, etc) on the user's workstation. Server-based can involve a variety of different components including: proxy servers, caching servers (eg, AppFabric AKA Distributed Caching), and application-based, such as SharePoint caching methods. This posting focuses on implementing SharePoint-based caching methods useful in common SharePoint 2013 intranet deployment scenarios.
There are three SharePoint-based caching methods that can be implemented: binary large object (BLOB) caching, page output caching and object caching. All of these have been available since at least 2007. There is a fourth kind of SharePoint-based caching, anonymous search results caching, but that won't be discussed here. BLOB caching involves the web server storing locally on disk those dependent files used by web pages so as to reduce database requests and thereby reducing processing and improving responsiveness. Page output caching is based upon ASP.NET caching. It involves the caching of web pages and even versions of those web pages so as to be able to immediately return a page to the user when it matches the user's request, thereby greatly improving responsiveness; it can be configured at the web application, site collection, site and page levels. Lastly, object caching involves the caching of page objects, i.e., lists, settings, page layouts, libraries, etc. Object caching can respond to page requests even when those requests involve different pages, but the same objects.
By default, the BLOB and page output caching are disabled on new deployment and must be enabled manually. Object caching is enabled at the site collection level on new deployment, after activating the Publishing feature. Enabling BLOB caching involves a simple edit of each web front end server's Web.Config file, and the same change must be implemented in each file. Enabling page output and object caching involves activating the Publishing feature. This posting walks through implementing each of these cache types.
Procedure
Implementing caching can substantially improve page performance. There are fundamentally two kinds: browser-based and server-based. Browser-based involves the user's browser storing pages and page components (eg, js files, image files, applets, etc) on the user's workstation. Server-based can involve a variety of different components including: proxy servers, caching servers (eg, AppFabric AKA Distributed Caching), and application-based, such as SharePoint caching methods. This posting focuses on implementing SharePoint-based caching methods useful in common SharePoint 2013 intranet deployment scenarios.
There are three SharePoint-based caching methods that can be implemented: binary large object (BLOB) caching, page output caching and object caching. All of these have been available since at least 2007. There is a fourth kind of SharePoint-based caching, anonymous search results caching, but that won't be discussed here. BLOB caching involves the web server storing locally on disk those dependent files used by web pages so as to reduce database requests and thereby reducing processing and improving responsiveness. Page output caching is based upon ASP.NET caching. It involves the caching of web pages and even versions of those web pages so as to be able to immediately return a page to the user when it matches the user's request, thereby greatly improving responsiveness; it can be configured at the web application, site collection, site and page levels. Lastly, object caching involves the caching of page objects, i.e., lists, settings, page layouts, libraries, etc. Object caching can respond to page requests even when those requests involve different pages, but the same objects.
By default, the BLOB and page output caching are disabled on new deployment and must be enabled manually. Object caching is enabled at the site collection level on new deployment, after activating the Publishing feature. Enabling BLOB caching involves a simple edit of each web front end server's Web.Config file, and the same change must be implemented in each file. Enabling page output and object caching involves activating the Publishing feature. This posting walks through implementing each of these cache types.
Procedure
- BLOB Caching
- Login to a farm web front end server.
- Launch IIS
- In the left Connections panel, expand the Sites node so that your website is shown.
- Right-click your website, and then select Explore.
- Make a copy of the Web.Config file.
- Open the Web.Config file in Notepad.
- Search for the tag <BlobCache.
- Set the location attribute to the path you want on your server.
This path should be the same for all web front end servers.
- Set the maxSize attribute as desired. The units here are in GB. This should be no lower than 10.
- Set the enabled attribute to true.
- Save and close the file. The change
Modification of the web.config file immediately triggers a recycle of the web application, which may result in some user data loss.
- Repeat for each web front end server. The modifications to the web.config file must be identical for each.
Any modification to the web.config file immediately precipitates an IIS reset.
. - Page Output Caching
- Activate Publishing (skip if already done)
- Login to a farm web front end server.
- Navigate to: Site Collection > Site Settings > Site Collection Administrator > Site collection features.
- Activate SharePoint Server Publishing Infrastructure.
- Now navigate to: Site Collection > Site Settings > Site Actions > Manage site features.
- Activate SharePoint Server Publishing.
- Set for entire web application
- Launch IIS Manager
- In the left-hand Connection panel, expand the server node and then expand the Sites node.
- Right-click on the target web application, and then select Explore.
- Make a copy of the web.config file.
- Open the original in Notepad.
- Set WFE1 Web.config: <OutputCacheProfiles useCacheProfileOverrides="true"…
- Set WFE2 Web.config: <OutputCacheProfiles useCacheProfileOverrides="true"…
- Save the file.
- Set for a site collection
- Navigate to: Site Collection > Site Settings > Site Collection Administration > Site collection output cache.
- Check the Enable output cache checkbox.
- Select the appropriate Anonymous and Authenticated profiles. For example, for a departmental farm situated on the corporate intranet, select Disabled for Anonymous and Intranet for Authenticated.
You are not restricted to these profiles. You can customize these are create new ones by navigating to: Site Collection > Site Settings > Site Collection Administration > Site collection cache profiles. Listed here are the four default profiles, and you can create new ones.
- If your farm employs both Publishing and non-publishing sites, it might be useful to distinguish among them - testing will be needed to determine this. Similarly, being able to configure page output caching by page layout can be useful when one or more layouts are used for specific high-volume data needs, such as search results pages.
- Click OK.
- Set for a site
- Navigate to: Site Collection > Site Settings > Site Administration > Site output cache.
- Here you have the option of configuring site caching to inherit the caching configuration of the parent site collection or specifying unique caching configuration.
- Select as desired, and then click OK.
- Set for a page
- Navigate to: Site Collection > Site Settings > Site Administration > Site collection output cache.
- Enter a check into the Page layouts can use a different page output cache profile setting.
- Click OK.
- Navigate to: Site Collection > Site Settings > Web Designer Galleries > Master pages and page layouts.
- Check or select the layout file you want to configure.
- On the ribbon, select the FILES tab.
- On the FILES tab, in the Manage group, click Edit Properties. You will also need to check out this file in order to edit its properties.
- Configure as desired, and then click OK.
- Page Object Caching
- Navigate to: Site Collection > Site Settings > Site Collection Administration > Site collection object cache.
- Configured as desired, and then click OK.
- Cache settings operations in SharePoint Server 2013
- Configure cache settings for a web application in SharePoint Server 2013
- Optimize page performance in SharePoint 2013
- Plan for caching and performance in SharePoint Server 2013
- AppFabric Caching and SharePoint: Concepts and Examples (Part 1)
- The Five Minute Cheat-Sheet on SharePoint 2013′s Distributed Cache Service
- SharePoint Publishing Features Functionality
- Custom Caching Overview in SharePoint Server 2010 (ECM): still useful, similar steps apply to 2013.
- Caching in SharePoint: for 2007 but still provides useful background and discussion.
- Administer cache settings and profiles: for 2007, but still applies. Provides links to more detailed articles.
- Configure page output cache settings for a site collection: for 2007, but same steps apply.
- Improving the Performance of your SharePoint sites: the most comprehensive posting I have found on performance. Outstanding article for advanced in-depth study on this topic.
- How to Configure Page Output Caching in SharePoint 2013
- Implementing caching for My Sites presents some minor challenges. The reason being that every user's My Site is a unique site collection.
- I was not able to find much MS SharePoint 2013 documentation on caching whilst exploring the SharePoint documentation tree. I was able to find much more detailed articles on caching in the 2007 documentation tree.
- Microsoft's discussion on enabling object caching in SharePoint 2013 only presents how to configure this by editing the web.config file. However, you can still configure object caching through site collection administration settings, as discussed above and in the Microsoft article for object caching SharePoint 2007.
No comments:
Post a Comment