Asif Maniar

Software Engineer
posts - 18 , comments - 16 , trackbacks - 0

Tricks and Optimizations for you Sitecore website

When working with Sitecore there are some optimizations/configurations I usually repeat in order to make my app production ready.

Following is a small list I have compiled from experience, Sitecore documentation, communicating with Sitecore Engineers etc.

This is not supposed to be technically complete and might not be fit for all environments.


Simple configurations that can make a difference:

1) Configure Sitecore Caches. This is the most straight forward and sure way of increasing the performance of your website.

Data and item cache sizes (/databases/database/ [id=web] ) should be configured as needed. You may start with a smaller number and tune them as needed.

<cacheSizes hint="setting">

Tune the html, registry etc cache sizes for your website.



Tune the prefetch cache settings under the App_Config/Prefetch/ folder.

Sample /App_Config/Prefetch/Web.Config:

  <!--preload items that use this template-->
  <template desc="mytemplate">{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}</template>

  <!--preload this item-->
  <item desc="myitem">{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX }</item>

  <!--preload children of this item-->
  <children desc="childitems">{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}</children>

Break your page into sublayouts so you may cache most of them.

Read the caching configuration reference:


2) Disable Analytics for the Shell Site

<site name="shell" virtualFolder="/sitecore/shell" physicalFolder="/sitecore/shell" 
rootPath="/sitecore/content" startItem="/home" language="en" database="core" domain="sitecore" 
loginPage="/sitecore/login" content="master" contentStartItem="/Home" enableWorkflow="true" 
enableAnalytics="false" xmlControlPage="/sitecore/shell/default.aspx" browserTitle="Sitecore" 
htmlCacheSize="2MB" registryCacheSize="3MB" viewStateCacheSize="200KB" xslCacheSize="5MB" />

3) Increase the Check Interval for the MemoryMonitorHook so it doesn’t run every 5 seconds (default).

<hook type="Sitecore.Diagnostics.MemoryMonitorHook, Sitecore.Kernel">
        <param desc="Threshold">800MB</param>
        <param desc="Check interval">00:05:00</param>
        <param desc="Minimum time between log entries">00:01:00</param>

4) Set Analytics.PeformLookup (Sitecore.Analytics.config) to false if your environment doesn’t have access to the internet or you don’t intend to use reverse DNS lookup.

<setting name="Analytics.PerformLookup" value="false" />

5) Set the value of the “Media.MediaLinkPrefix” setting to “-/media”:

<setting name="Media.MediaLinkPrefix" value="-/media" />

Add the following line to the customHandlers section:

  <handler trigger="-/media/" handler="sitecore_media.ashx" />
  <handler trigger="~/media/" handler="sitecore_media.ashx" />
  <handler trigger="~/api/" handler="sitecore_api.ashx" />
  <handler trigger="~/xaml/" handler="sitecore_xaml.ashx" />
  <handler trigger="~/icon/" handler="sitecore_icon.ashx" />
  <handler trigger="~/feed/" handler="sitecore_feed.ashx" />



6) Performance counters should be disabled in production if not being monitored

<setting name="Counters.Enabled" value="false" /> 


7) Disable Item/Memory/Timing threshold warnings. Due to the nature of this component, it brings no value in production.

<!--<processor type="Sitecore.Pipelines.HttpRequest.StartMeasurements, Sitecore.Kernel" />--> 

<!--<processor type="Sitecore.Pipelines.HttpRequest.StopMeasurements, Sitecore.Kernel">
  <TimingThreshold desc="Milliseconds">1000</TimingThreshold> 
  <ItemThreshold desc="Item count">1000</ItemThreshold> 
  <MemoryThreshold desc="KB">10000</MemoryThreshold> 

8) The ContentEditor.RenderCollapsedSections setting is a hidden setting in the web.config file, which by default is true. Setting it to false will improve client performance for authoring environments.

<setting name="ContentEditor.RenderCollapsedSections" value="false" /> 


9) Add a machineKey section to your Web.Config file when using a web farm. Link:


10) If you get errors in the log files similar to:

WARN Could not create an instance of the counter 'XXX.XXX'

(category: 'Sitecore.System')

Exception: System.UnauthorizedAccessException

Message: Access to the registry key 'Global' is denied.

Make sure the ApplicationPool user is a member of the system “Performance Monitor Users” group on the server.


11) Disable WebDAV configurations on the CD Server if not being used.



12) Change Log4Net settings to only log Errors on content delivery environments to avoid unnecessary logging.

      <priority value="ERROR" />
      <appender-ref ref="LogFileAppender" />
(From Sitecore: please note that this may result in Sitecore Support not being able to help you immediately due to log incompleteness. 
Logging reconfiguration might be necessary before
further investigation could be performed.)

13) Disable Analytics for any content item that doesn’t add value. For example a page that redirects to another page.




14) When using Web User Controls avoid registering them on the page the way:

<%@ Register Src="~/layouts/UserControls/MyControl.ascx" TagName="MyControl" TagPrefix="uc2" %>

Use Sublayout web control instead – This way Sitecore caching could be leveraged

<sc:Sublayout ID="ID" Path="/layouts/UserControls/MyControl.ascx" Cacheable="true" runat="server" />


15) Avoid querying for all children recursively when all items are direct children.




16) On IIS — you enable static & dynamic content compression on CM and CD




17) Enable HTTP Keep-alive and content expiration in IIS.



18) Use GUID’s when accessing items and fields instead of names or paths. Its faster and wont break your code when things get moved or renamed.


//is better than



Hope this helps.

Print | posted on Wednesday, March 21, 2012 5:18 PM | Filed Under [ ASP.NET Sitecore C# ]


No comments posted yet.
Post A Comment

Powered by: