Thursday, May 3, 2012

My Simple Rules for SharePoint 2010 Caching


I am always a fan and a true believer of caching.
So what is a cache?
A temporary storage area where frequently used data can be stored for rapid access.

Based on my experience developing and configuring SharePoint 2010 solution for many clients I have a few simple rules about caching in SharePoint 2010. The 4 different types of caching available in SharePoint 2010 and my simple rules for them:

1. Object Caching
- To activate: Site Actions – Site Settings – Site collection object cache.
- Default max cache size: 100 MB.
- Optimum cache size: depends on the server specification but I reckon 1 GB is the sweet spot.
- Default Duration: 180 seconds.
- Optimum duration: depends on the business but I reckon between 15-20 minutes is the sweet spot.

2. Output Caching
- To activate: Site Actions – Site Settings – Site collection output cache.
- Available profiles: Site Actions – Site Settings – Site collection cache profiles.
- Public Internet (Anonymous) profile:
     Default duration: 180 seconds.
     Optimum duration: depends on the business but I believe between 30-60 minutes.
     Default cacheability: ServerAndPrivate.
     Optimum cacheability: Public -> it means “always cache it if you can” in any server possible.
- Intranet (Collaboration Site) profile:
     Default duration: 180 seconds.
     Optimum duration: depends on the business but I believe around 15 minutes.
     Default cacheability: ServerAndPrivate.
     Optimum cacheability: Public -> it means “always cache it if you can” in any server possible.

3. Blob Caching
- Stores frequently used files in the disk instead of database.
- The setting is in the web.config.

4. HttpRunTime Cache
- General IIS cache used by ASP .NET.
- Use this caching method whenever possible.
- Generally used for 3rd party services (Google Weather, Yahoo Finance and other services).
- It is also very useful to server content / list items which appear the same to everyone (such as utility links, reusable content viewer, etc).