9

I am trying to determine the optimal size for the htmlCacheSize on a website in Sitecore.

We're assembling a website that will be ~1500 pages in 13 languages. Initial tests show that the current "en" site uses ~40mb of cache.

Doing some quick and dirty math, that leaves me with:

40MB * 13 languages ~= 500MB cache size.

Is this the proper way of determining how large of a cache I should use? Additionally- would there be any problems in just setting the cache size to something like 512MB?

EDIT: Adjusted the numbers a bit after doing some tests.

4
  • 1
    Don't start with too big cache size. Start with something smaller. Then after your site is used, check /sitecore/admin/cache.aspx page if what you set is enough. If not, increase the size gradually. And make sure that your cache keys are smart enough not to cache output for every user separately. And think twice before you cache things you may want to personalize. Nov 13 '17 at 20:27
  • No personalization, and a large majority of the cache is set to "Vary By Page" and "Vary By Data", where Vary By Page is a custom caching option which inserts the page id into the cache key. Nov 13 '17 at 20:28
  • 1
    Cache and rendering stats are also saved to disk every 10 mins, use these to determine how the caches are behaving over time: jammykam.wordpress.com/2015/12/18/…
    – jammykam
    Nov 13 '17 at 20:59
  • Unsure of your Sitecore version, but if you do use the HealthMonitor RenderingStatistics, there was a bug where it would just overwrite the same file again and again, so bear that in mind. This was fixed in Sitecore 8.2 Update 3, but you would be able to request a patch for other versions (Issue ref 125593).
    – Kasaku
    Nov 13 '17 at 22:48
2

Just to follow up-

I ran with the math in my post. The website has been in production for over a year now and is running smooth and fast. Memory is cheap, use it. Bump your cache up high, "warm up" all of your pages, and check your cache size. Shoot for somewhere around 20% higher than that number and be done with it.

1
  • upvoted despite the "be done with it". As mentioned in the other post, ideal sizes might change over time, so it's worth checking it every now and then. Nov 11 '20 at 8:57
1

There's not optimal cache size when your site hasn't yet got many visitors, it's only after your site gets used a bit that you will be able to tweak your caches.

Also, cache tuning is a perpetual process, so you should reassess your site's cache sizes periodically.

I still find that the Cache Tuner module is useful, even after some years: https://marketplace.sitecore.net/en/modules/cache_tuner.aspx

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.