Skip to content
March 5, 2011 / kiranpatils

Sitecore caching

Challenge:

Caching is not only the most important bit in Sitecore. But also not well documented [They are working on it!]. We always worked hard to understand the caching and tried to use caching up to its fullest extent.

Would like to share our findings in this article.

Solution:

All Sitecore Caching Basics: It’s always good to know the basic concepts deeply to become expert in any topic. So, before we move on to become Sitecore caching expert. Let’s understand the basics of Sitecore Caching.

This is the diagram — Which I always look at whenever I would like to clear my Sitecore Caching Concepts.

So what and when are things actually cached? Well look at this graph, which shows how a request is handled.

  1. If the item which is requested has presentations which are cached, the HTML from the HTML cache is returned and the request is ended.
  2. If there isn’t any HTML cached all items needed by the presentation is requested from the item cache.
  3. If the items aren’t in the item cache it is retrieved from the data cache and parsed into an Sitecore.Data.Items.Item and stored in the item cache.
  4. If the item isn’t present in the data cache, it is retrieved from the prefetch cache and the ItemInformation is stored in the data cache.
  5. If the item isn’t in the prefetch cache it is retrieved from the database and stored in the prefetch cache as PrefetchData.

To read more about Sitecore caching. You must read :

http://learnsitecore.cmsuniverse.net/en/Developers/Articles/2009/07/CachingOverview.aspx

How Can you check what’s your cache size? Or get Caching Statistics?

Cache Administration Page

The Cache Administration page provides information about each of the Sitecore caches. You can use the Cache Administration page to monitor Sitecore cache utilization and to clear the Sitecore caches.

You can access the Cache Administration page at the following URL: http:///sitecore/admin/cache.aspx
Replace <hostname> with the hostname of your CMS server.

The Rendering Statistics Page

The Rendering Statistics page provides information about each of the renderings for which an entry exists in each site HTML (output) cache. You can use the rendering statistics page to identify under-performing renderings and renderings for which you can improve cache configuration.
You can access the Rendering Statistics page at the following URL: http:///sitecore/admin/stats.aspx

Replace <hostname> with the hostname of your CMS server.

Update[2nd March 2012]:

“Sitecore Items cache[Level2 from top in earlier shown diagram] stores formed Item objects, Data cache [Level3] stores Item data objects – something like item for all versions, Prefetch cache [Level4] stores item fields, child list, and something like raw data. In our case only item cache gets cleared, there will be no additional database requests, in case if required data is in , Data cache [Level3] or in the Prefetch cache [Level4]. So, we are going to increase cache size for Data cache [Level3] and Prefetch cache [Level4]. So, it will serve the data from cache only rather than talking to database[Level5] directly.”

What should be the ideal cache size?
It depends on your server environment. But the basic rule is  Bigger Cache Size == better performance

You can use Cache Configuration Reference:
http://sdn.sitecore.net/upload/sitecore6/sc62keywords/cache_configuration_reference_a4.pdf

If you are the guy/gal who hates to read and loves to watch, This Sitecore caching webinar recording is for you:
http://sitecoreaustralia.wordpress.com/2010/06/28/cache-webinar-recording/

Good to read :

http://sitecore.spaces.live.com/default.aspx?_c11_BlogPart_BlogPart=blogview&_c=BlogPart&partqs=cat%3DCaching&sa=178587253

Cache Sizing:
http://sdn.sitecore.net/SDN5/Articles/Administration/Sitecore%20Performance/Caching/Cache%20Sizing.aspx

Caching options:
http://www.sitecore.net/Community/Technical-Blogs/John-West-Sitecore-Blog/Posts/2010/12/Caching-Options-in-the-Sitecore-ASP-NET-CMS.aspx

I hope you found this article useful. If you have any question Or have good caching link/document/knowledge which you would like to share with others. Please do share!

Happy Sitecore Caching! 🙂

Advertisements

16 Comments

Leave a Comment
  1. Nilesh Thakkar / Mar 6 2011 8:27 am

    Worth to read.. and Good initiative.. Proud to have such a friend…

    • kiranpatils / Mar 6 2011 5:48 pm

      Thanks for the appreciation Nilesh! Same here! 🙂

  2. Vk / Jan 23 2012 9:51 pm

    Thanks for providing the above information. After reading your post I have a question that if my Sitecore database is down for 2 or 3 min and If a user requests a page at the same time(when database is down) will Sitecore render the page from cache or is it going to throw an error saying database is down. I am assuming that it will throw an error but why does it need to do a database transaction when the page is already in Cache.

    • kiranpatils / Feb 17 2012 10:44 pm

      Thanks for the nice words!

      I haven’t tried it. But I agree that it will throw exception as DB is down and as per my view it is correct. Because for few things Sitecore will be surely contacting DB.

      But still I would suggest you to give a go and check what happens, please do share your results with us.

      Happy Sitecoring! 🙂

      Keep visiting, Keep reading and Keep sharing!

      Kiran

  3. heavy addiction / Apr 27 2013 5:04 am

    Wow that was strange. I just wrote an really long comment but after I clicked submit my comment didn’t appear. Grrrr… well I’m not writing all that
    over again. Anyhow, just wanted to say superb blog!

    • kiranpatils / May 1 2013 11:30 pm

      Thank you for the appreciation, it matters a lot!

      Keep visiting! Keep reading! Keep sharing!

      Sincerely.
      Kiran Patil

  4. Judson / Jun 18 2013 1:06 pm

    This excellent website really has all the info I wanted about this subject and didn’t know who to ask.

Trackbacks

  1. Publishing and Cache Clearing Basics « Sitecore basics!
  2. Basics of Cache Size Tuning « Sitecore basics!
  3. Basics of Sitecore Startup « Sitecore basics!
  4. Cache Tuner User Guide « Sitecore basics!
  5. Is your HTML Cache working? « Sitecore basics!
  6. Does your CM server performing slow? « Sitecore basics!
  7. Basics of HTML Caching « Sitecore basics!
  8. Why I love Sitecore? « Sitecore basics!
  9. Basics of Sitecore full cache clearing « Sitecore basics!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: