A Comprehensive Guide to Configuring Rendering Partial HTML Cache Settings in Sitecore

Performance

Sitecore, renowned for its robust content management capabilities, offers an incredibly powerful feature: partial HTML caching. This feature is not just a tool; it's a strategy, enabling developers to cache specific parts of a webpage rather than the entire page. This approach offers a multitude of benefits, dramatically enhancing the performance and scalability of Sitecore-powered websites.

By strategically configuring rendering partial HTML cache settings, developers can significantly reduce server load, minimize calls on third party systems, and, most importantly, decrease page load times. This not only improves the overall user experience but also positively impacts SEO rankings, as search engines favor faster-loading websites.

In this guide we will look at three scenarios for configuring rendering HTML cache that will provide the biggest performance benefits, finishing with the best of both worlds between caching aggressively and clearing the cache when needed.

  • Cache and vary by data, do not clear (most aggresive)
  • Cache and vary by data, clear on publish (the default)
  • Cache and vary by data, clear on content update (best of both worlds)
An illustration of an engine powering the internet

Moving At The Speed of Cache

Cache and vary by data, do not clear

Static site generation and the 'Cache and vary by data, do not clear' strategy in Sitecore present two facets of the same principle: optimising web performance through pre-rendered content. Static site generation achieves this by building pages ahead of time during deployment, turning dynamic content into static HTML files. Similarly, Sitecore's caching strategy stores rendered components in memory, allowing for their retrieval without the need to re-render for each request. Both approaches deliver content with optimal speed.

However, this emphasis on speed introduces a challenge, particularly for editorial teams accustomed to the dynamic nature of content updates. With static site generation, any content change necessitates a complete rebuild and redeployment of the static files. The 'Cache and vary by data, do not clear' strategy in Sitecore encounters a parallel hurdle; cached content remains unchanged until explicitly cleared, leading to a lag in content updates becoming visible on the live site. This scenario means that unless the Sitecore application is restarted or the cache is naturally flushed, updates made by editorial teams won't be immediately apparent to the end-user.

Cache and vary by data, clear on publish

Static site generation with revalidation and Sitecore's 'Cache and vary by data, clear on publish' strategy share a common goal: to serve up-to-date static content efficiently while ensuring that new content is reflected promptly upon publication. This approach offers the best of both worlds by marrying the speed of static content delivery with the dynamism of content management systems. While this method guarantees that updates are immediately visible, it does so with a broad stroke, clearing all caches irrespective of whether they contain updated content or not. This brute-force approach ensures content freshness but can temporarily diminish the performance of the site while caches repopulate, this can be observed as a 'hill-effect' when looking at site performance data.

Cache and vary by data, clear on content update

Incremental static site generation and Sitecore's 'Cache and vary by data, clear on content update' strategy share a sophisticated approach to content delivery, balancing the speed of static content with the need for content freshness. Incremental static generation allows for the selective rebuilding of parts of a site that have changed, rather than regenerating the entire site for each content update. This mirrors the precision of Sitecore's nuanced caching strategy, which clears cache only for content that has been updated, leaving unaffected content swiftly accessible.

This method provides a seamless user experience by ensuring content is both up-to-date and delivered with the efficiency of static caching. However, achieving this level of targeted cache clearance requires configuration of rendering content dependencies in Sitecore. By investing time in setting up these dependencies correctly, developers can ensure that only the necessary parts of the cache are cleared upon content updates, thus maintaining optimal performance while reflecting the latest changes—a truly best-of-both-worlds scenario.

Through the strategic configuration of rendering partial HTML cache settings in Sitecore, we have a powerful tool at our disposal that bridges the gap between the need for fast page loads and the dynamic nature of content updates.

This technique ensures that our digital platforms not only meet but exceed the expectations of both end-users and editorial teams.