Sitecore Personalization Rules Vs Caching

I recently ran into an issue with a personalization rule on a rendering that changed the data source for mobile devices, a common scenario if you want to reduce payload and improve mobile experience. However, I discovered if I hit a page with the component on a mobile device I was seeing the desktop version.

Using my SPE script to list component cache settings I discovered the component had “Vary By Data” enabled – could this be the problem? As it turns out it it was. You see Personalization rules enable dynamically changing of components and their data sources. However the “Vary By Data” option causes Sitecore to render cached html markup for the component without performing an actual rendering process. For the majority of scenarios applying personalization rules before retrieving output from cache would make caching almost pointless. But there are certain scenarios, like the one I described above, where this might be beneficial and improve performance. Thankfully, there is a solution using a custom “Vary By Personalized Data” covered here by Ahmed Okour.

It does feel like a gap in Sitecore’s implementation so you either Cache a component or you Personalize it. So this needs to be captured when defining requirements.

Is this component going to be personalized?

  • No – implement caching.
  • Yes – don’t implement caching.
  • Not sure – implement caching and disable it when the component needs to be personalized.
  • Need both – customize with Vary By Personalized Data.

Useful Info

Tips for Monitoring and Tuning Sitecore Cache

Utilizing caching improves Sitecore performance and there are plenty of posts on this topic. While doing some performance analysis on an inherited solution I was surprised to find that caching was not being utilized to its full potential. In this post, i’ll share some useful scripts and tools that make the task of monitoring and tuning cache settings easier.

Continue reading

Handy JMeter Script to crawl your site

JMeter is my tool of choice for load testing. This isn’t necessarily a load test but rather a useful script to crawl site urls using a sitemap. By hitting every accessible url allows Sitecore to populate all the various caches and provides you with a sense of the potential sizes of the various Sitecore caches and helps you identify any tuning that may be required.

Continue reading