











We can monitor the cache using Sitecore OOTB application pages http://[host]/sitecore/admin/cache.aspx.





There are many types of cache’s in Sitecore like Prefetch Cache, Data Cache, Item Cache, Html Cache/Web Cache/Output Cache (Rendering Cache).





For Data cache Configuration we can specify the maximum size of the data cache in the web.config. You can either alter the DefaultDataCacheSize setting:





< setting name = "Caching.DefaultDataCacheSize" value="10MB" />





Or you can set it per database in the /databases/database section:





< cacheSizes hint = "setting"> < data > 20MB</data> < items > 10MB</items> < paths > 500KB</paths> < standardValues > 500KB</standardValues> </ cacheSizes >





The HTML cache will be different depending on which item you are trying to access. Below describes the different vary by parameters: • Vary by Data: Sitecore caches the output based on the item accessed. When the same item is accessed for the second time, the HTML will be loaded from the cache. Typically used for headers and footers. • Vary by Device: Sitecore caches copies of the output for each Device being used. Recommended for adaptive designs. • Vary by Login: Sitecore caches two copies of the output. One is for authenticated Extranet users and one is for unauthenticated Extranet users. • Vary by Param: Sitecore caches the output for each parameter accepted by the rendering. Used in conjunction with rendering parameters. • Vary by QueryString: Sitecore caches the output for each unique combination of query string parameters. Used with forms that have been embedded into the site. • Vary by User: Sitecore caches the output for each authenticated user. Used with personalization enabled on websites.

Configuration: You can configure the allowed size of the HTML cache and whether it should be enabled or not for each of your sites. This is done in the sites section of the “<drive>\inetpub\wwwroot\website\web.config”. See the following line:





< site name = "website" virtualFolder="/" physicalFolder="/"rootPath="/sitecore/content " startItem="/Home"database="web" domain="extranet" cacheHtml="true" htmlCacheSize="10MB" enablePreview="true"enableWebEdit="true" enableDebugger="true"disableClientData="false" />









We need to update configuration files or need to add patch config for Cache related changes: 1. Prefetch cache: Sitecore has prefetch caches for each database it uses (Core, Master and Web). The configuration files it uses are located in \Website\App_Config\Prefetch.

Add Prefetch via Patch config : Bigger Prefetch gives slow startup, but it can give you better performance while opening Content Editor or Page Editor because your items’ data are already fetched from Database to Prefetch Cache.

When to use prefetch -You should use prefetch in the Homepage, for example, as it is the most frequently visited page. -You should prefetch Home item and its immediate children.

Also, a News pages should be prefetched as it is supposedly visited frequently. You should prefetch “News Template” and their children, for example.

For better Prefetch cache, you have to find out three things: - Which are the pages used the most in your site like Homepage. - Which are the pages, whose children are accessed frequently. - Which kind of pages(templates) are used the most.

• <cachesize>300MB</cachesize>: describes Sitecore will do prefetch upto 300MB. • <template desc="mytemplate">{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}</template>: Defines that items of the specified template will be prefetched. • <item desc="myitem">{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX }</item> :Defines that the specified item will be prefetched. • <children desc="childitems">{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}</children>:Defines that specified children of the given item will be prefetched. • <childlimit>100</childlimit>:Defines a limit to the number of children to include in the prefetch cache.





Remove Prefetch via Patch config:

Bigger Prefetch gives slow startup, but it can give you better performance while opening Content Editor If you already tried increasing DTU's on databases or upscaling the server to B3 in Sitecore Azure PaaS and still facing, slowness in first load of pages in the sitecore backend (login, desktop, experience editor, content editor). In the above cases, we have check the Prefetch cache settings for following keys in the environment using [WebRoot]/sitecore/admin/cache.aspx: verify its cache limit • SqlDataProvider - Prefetch data (core) • SqlDataProvider - Prefetch data (master) To improve the performance, we can remove these prefetch caches by using the patch provided by the Sitecore support team (https://kb.sitecore.net/articles/290593): deploy this patch file

The Sitecore Experience Platform cache's prefetch functionality attempts to pre-populate item caches on role start up. This causes excessive SQL Server DTU consumption on the core database, SQL timeout exceptions, and unresponsive websites. In some cases, for example on topologies with 4 Sitecore roles and small SQL Server tiers, the DTU on the core database can reach 100% and remain there for up to 40 minutes.



https://sitecore.stackexchange.com/questions/12183/how-can-i-improve-startup-times-content-management-in-azure-paas

https://kb.sitecore.net/articles/290593





2. Set Initial Cache Values :





In this task we will learn how to sets the initial values for the Sitecore Database and html output Caches, depending on the environment. These values are used during the tuning phase of the caches and find below sample cache values:









CM instance configuration files :





For Core DB:





CD instance configuration files :





For Web DB:





Tuning of Initial Sitecore Cache

This task describe the procedures used to tune the Sitecore prefetch, data, and item caches, using a load generator and the Sitecore cache.aspx page to monitor the size and eviction of the various caches.

Cache tuning is an ongoing process that needs to be revisited from time to time.



1. While the load generator is running, navigate to /sitecore/admin/cache.aspx page. The caches of interest, depending on environment, are the Master[data], Master[items], Web[data], Web[items], SqlDataProvider- Prefetch data(master), and SqlDataProvider - Prefetch data(web).





Azure Portal Changes: Go to top

We can work on following items in Azure Portal to improve the performance of Sitecore instance:

1. Deploy Resources to Premium(P) v2 2. Sql servers to better Database Thermal Unit (DTU) 3. Move all db's to elastic pool Check article: How to boost your Sitecore Azure Paas website for zero dollars



In the previous Sitecore Performance Tuning article Collect Sitecore Site Performance Data points I explain about how Sitecore OOTB tools like admin pages, configurations, etc. can be used to collect the data points which can be used as a starting point to concentrate on particular Sitecore related resources.In the continuation of Sitecore performance tuning, I will try to explain the ways which needs to be consider in Sitecore development for website. For this web to work on following items in SitecoreSitecore uses various caches to store data, rendered presentation logic and other information in memory in order to improve performance and response time. A cache is a dictionary that keeps track of when each entry is accessed. The data that is stored for each entry depends on the cache. How the cache is used also depends on the cache.The details of different caches are: These are caches that inherit from Sitecore.Caching.CustomCache class. There are many more caches that are instances of Sitecore.Caching.Cache.If the, or if the> 80% of theby 50%.If the size of the, decrease the