Output Caching to Speed up SharePoint 2010 Publishing Sites

Caching frequently accessed pages can results faster response time for any web site. Output caching in SharePoint 2010 behaves similarly to output caching in ASP.NET. With SharePoint 2010 output caching, subsequent requests for a same page within the cache duration will be served from the output page without executing the code that created it. That means no round trip to the database to fetch the source code for the page or controls on the page, resulting less CPU time to serve the page.

In order to enable Output Caching for a site collection;
From the root site ‘Site Settings’, find ‘Site collection output cache’ from the Site Collection Administration section.

Select the Enable output cache check box to enable output caching. We can select different cache profiles for anonymous users and authenticated users. In the below figure I have chosen a cache profile from the Anonymous Cache Profile list. This profile is applied when anonymous users access a site in this site collection. For authenticated users output caching is disabled. Also there are options to check if publishing sites or page layouts need to use different output cache profiles.

By selecting 'Enable debug cache information on pages' option, we can see additional cache information on the page source. (Right click -> View page source)

Display cache profile and the date and time that page contents were last rendered;

Display reason why output cache is not used;

Available site collection cache profiles can be accessed by navigating to 'Site collection cache profiles' under Site Settings -> Site Collection Administration section.

Output Caching can be configured at sub-site level also. For that go to;
Site Actions -> Site Settings
Select ‘Site output cache’ in the Site Administration section

More information on output caching and creating new cache profiles can be found at in MSDN here.

Without enabling output caching, initial load took 3.41 seconds.

Without enabling output caching, re-loading of the same page took 3.01 seconds.

After enabling output caching, re-loading of the same page took 33 milliseconds only.