1

I was trying to see how much prefetch cache is being utilized on my CD server. I accessed cache status pages and found out that they are not getting filled after restarting the app (I made config changes to restart the app). I can say this because when app was restarted, prefetch cache value was 97.3MB, after 2 hours it became 393.3MB.

What I understood from Sitecore documentations is, it get populated on app start. Is there something wrong with my understanding?

What should I do to get an idea about cache usage?

One more question, my server memory is varying between 68% to 72%, will increase in Cache max value make it worse? What is the general rule of caching with respect to memory usage?

1

1 Answer 1

2

Based on the link you have, I think you already have tried Prefetch config, but just in case, I will include it.

Prefetch cache is the amount of data that Sitecore will load before anybody makes any data requests. The more you prefetch, the slower your startup will be but the less likely that a page request will need to load data. Also, the more you prefetch, the more system memory you use and the more data requests ping the data layer at startup. In general, you need to tweak this to a level that gives you an acceptable start up time, and doesn't consume all your system memory or pin your database. Or you may need to add more memory if you need more cache for some reason. Other items are loaded into cache after startup as needed.

You alter the amount of prefetch by using a config patch to change the value of the prefetch cache size. Here is a version of the example from the docs:

<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/"
       xmlns:set="http://www.sitecore.net/xmlconfig/set/" xmlns:role="http://www.sitecore.net/xmlconfig/role/">
   <sitecore>
      <databases>
         <database id="web" role:require="ContentDelivery or Standalone">
            <dataProviders>
               <dataProvider>
                  <param desc="headProvider">
                     <dataProvider>
                        <prefetch>
                
   <cacheSize>1000MB</cacheSize>
                        </prefetch>
                     </dataProvider>
                  </param>
               </dataProvider>
             </dataProviders>
         </database>
      </databases>
   </sitecore>
</configuration>

Reference the prefetch configuration docs here: https://doc.sitecore.com/xp/en/developers/102/platform-administration-and-architecture/configure-prefetch-cache-values.html

You can also look to optimize what gets prefetched by configuring specific templates and item paths to load. This way you can prefetch only the pages you know are visited most often. You can see docs about this here: https://doc.sitecore.com/xp/en/developers/102/platform-administration-and-architecture/optimize-or-disable-the-prefetch-caches.html

2
  • Thanks Jason, so I can add templates in configuration file that I want to be prefetched during start up?
    – Imad
    Mar 29, 2022 at 12:34
  • 1
    More than just templates, but that is one option for configuring what to prefetch. Mar 29, 2022 at 12:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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