Configuring Content Caching

One common theme across all SharePoint sites, including publishing sites, is that virtually all the content is stored in a Microsoft SQL Server database. The only content that's not included in the database is the JavaScript, CSS, images, and some ASPX files that are common to all sites (such as the pages you see linked from Site Settings). For a publishing site, this means all images, style sheets, custom JavaScript files, and documents will be stored in SQL Server. Every time a page is requested, SharePoint will go back to the database to retrieve the content. This is an obvious detriment to the performance of the site because fetching data from SQL Server compared to pulling it from memory or off the local hard disk of the SharePoint server takes considerably longer.

So how do you get around this bottleneck? Caching! Thankfully, SharePoint has advanced and granular configuration settings that give site administrators complete control over the level and type of caching available to publishing sites. SharePoint provides two types of caching mechanisms:

  • Page output caching The process of persisting the compiled page in memory on the SharePoint server, eliminating the need to go back to the database for any subsequent requests for the same page.

  • Disk caching Static content, such as images, CSS, and JavaScript files are persisted to the hard disk of the SharePoint server after they are retrieved from the server. Subsequent requests for these resources will result in SharePoint pulling them off the disk and returning them back to the requester rather than making another call to the database.

In a publishing site, cache settings are defined in profiles. These profiles are then available to the entire site collection, but each site can either inherit the cache configuration of the parent site or override the parent and define its own profiles.

Configuring Cache Profiles

The cache profile administration interface is available by clicking the Site Collection Cache Profiles link under the Site Collection Administration column from the site collection's Site Settings page. When a publishing site is created, the following four profiles are created by default:

  • Disabled This profile disables caching.

  • Public Internet (Purely Anonymous) This profile is configured to do no authentication checks and will be the fastest option; However, it should be used only when it's acceptable that everyone can view the same page.

  • Extranet (Published Site) This profile is configured to cache only major versions of pages and always check permissions when content is requested.

  • Intranet (Collaboration Site) This profile is configured to always check permissions when content is requested and cache major as well as minor versions of pages.

To create a new profile, click the New button on the list toolbar. As you can see in Figure 11-9, you have plenty of configuration options when creating a policy. Using these options, you can specify whether you want to check for permissions on each object request, choose from numerous Vary By options (custom parameter, HTTP header, query string parameters, and rights), specify whether users with Edit rights can view the items in cache, or specify whether the page is always pulled from the database and bypasses cache. The options aren't explained in detail here because a good description is listed with each field.

image from book
Figure 11-9: Cache Profile creation page

Enabling Page Output Caching

Page output caching in SharePoint is similar to ASP.NET 2.0 output caching. Essentially, this edge form of caching enables Web front-end (WFE) servers to store the rendered output of the controls on a page and persist them in memory. When page output caching is enabled, the following occurs:

  • When a page is requested, SharePoint retrieves all necessary information from the database and compiles the page, storing the resulting objects in memory.

  • The next time the page is requested, SharePoint checks to see whether the page exists in memory. If it does, SharePoint retrieves the objects from cache and uses them in rendering the response to the requester. If the objects aren't in memory, it repeats the first step.

  • After a specified time has elapsed (configurable within the cache policy), the objects in cache are invalidated and purged. This feature prevents any stale information from being returned to the users.

To enable page output caching for a publishing site, complete the following steps:

  1. Click the Site Actions menu, select Site Settings and then select Modify All Site Settings.

  2. Under the Site Collection Administration column, click the Site Collection Output Cache link. If output caching is not enabled, you'll see a single check box to enable the cache. Selecting this check box refreshes the page, yielding additional configuration settings. As shown in Figure 11-10, you'll see that you can select a cache profile, created earlier, as the anonymous and authenticated profile. You can also optionally specify different policies for page layout designers. These options can be helpful because your designers can always be sure they are seeing their latest changes and not some cached changes from before.

image from book
Figure 11-10: Site Collection Output Cache Settings page

SharePoint also gives site administrators the ability to specify how many objects are stored in cache, as well as forcing a flush of the object cache on a server-by-server basis or across the entire farm. These actions can be performed from the Object Cache Settings page, which is available via the Site Collection Object Cache Settings link on the Site Settings page under the Site Collection Administration column.

Enabling Disk Caching

Another type of caching that SharePoint Server 2007 offers is disk-based caching. This is the process of persisting specified file types to the physical disk of the WFE server when they are initially retrieved from the database, making future database requests unnecessary and resulting in a significant performance increase. Typically, you would want to persist only static files to the disk, such as images (*.gif/*.jpg/*.png), movies (*.wmv), media (*.swf), style sheet files (*.css), and JavaScript files (*.js).

Enabling disk caching for a publishing site is very simple even though there is no browser UI as with page output caching. To enable disk-based caching:, open the publishing site's web.config file located in the Web Application's root directory and search for the <blobcache> node. Using the attributes in this node, you can turn on disk caching on the WFE (attribute: enabled), specify the location where files will be persisted (attribute: location), specify the type of files that will be persisted as a regular expression (attribute: path), and specify the maximum size the disk cache can reach in GB (attribute: maxSize).

Although there is no browser UI provided to save the disk caching settings, you can use the same administration page you used for the page output cache to flush the disk based cache: the Site Collection Object Cache Settings link on the Site Settings page under the Site Collection Administration column.

Microsoft Office Sharepoint Server 2007 Administrator's Companion
MicrosoftВ® Office SharePointВ® Server 2007 Administrators Companion
ISBN: 0735622825
EAN: 2147483647
Year: 2004
Pages: 299

Similar book on Amazon
Microsoft Office SharePoint Server 2007 Best Practices
Microsoft Office SharePoint Server 2007 Best Practices
Microsoft SharePoint 2010 Administrator's Companion
Microsoft SharePoint 2010 Administrator's Companion
Professional SharePoint 2010 Administration
Professional SharePoint 2010 Administration
Inside Microsoft  Office SharePoint  Server 2007
Inside Microsoft Office SharePoint Server 2007 © 2008-2017.
If you may any questions please contact us: