Speed Up Sitecore instance

All Sitecore developers know, that waiting for Sitecore load can be very annoying – especially when we do not have time.

In this post I’ve written about some tricks – but remember, they should NOT be used on the production environment.

Dynamic Compilation

About .net dynamic compilation you can read here: click

In simple words – everytime when you changing some code which has some references (let say inside class) all dll files should be recompiled and this process in bigger applications (like Sitecore) takes a lot of time. So we can decide to compile only changed parts.

Inside /sitecore/system.web/ in web.config file we should set

<compilation optimizeCompilations="true" />

So final definition could look like:

<compilation defaultLanguage="c#" debug="false" targetFramework="4.5"  optimizeCompilations="true">

If you want to make your compilation more selective you can also set “batch” to false value. To read more about this: click

<compilation defaultLanguage="c#" debug="false" targetFramework="4.5"  optimizeCompilations="true" batch="false" >

You can also consider to use RAMDisk (example of software : click) for your compilation temporary files.

Then your definition for compilation would look like:

<compilation defaultLanguage="c#" debug="false" targetFramework="4.5"  optimizeCompilations="true" batch="false" tempDirectory="X:\TEMP\">

Pros of this feature you will see especially when you have old HDD rather than SDD.

Thanks to: http://blog.lavablast.com/post/2010/12/01/Slash-your-ASPNET-compileload-time.aspx

Publisher evidence (authenticode signature veryfication)

It is default mechanism which you can disable on your development environment. If you want to know more, please read here: click

Inside directories:

%windir%\Microsoft.NET\Framework\[version]\config\machine.config

%windir%\Microsoft.NET\Framework64\[version]\config\machine.config

you should update file “machine.config” and set in node “/coniguration/runtime” folowing value (patch of course would be better):

<generatePublisherEvidence enabled="false"/>

Sitecore Performance Counters

Counters store an information about number of different activities. They can be very useful but if you at particular moment do not need them, you can just turn off them (patch of course would be better).

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

Thanks to: https://sitecorebasics.wordpress.com/2011/03/17/all-about-sitecore-performance-counters-a-real-hero/

You can do it by yourself or use SIM “Configuration – Sitecore 8 – Development – Initialize Speed Booster” (here you can find configuration file: click).

Prefetch Cache

Prefetch cache is the basic cache for production environment so it is good to allocate as mach memory as it is possible for it. But what is good for production environment, not always also good for development environment.

Bigger prefetch cache also means longer Sitecore starting process.

You can change files inside App_Config/Prefetch/ directory.

Decrease size of cache in “configuration/cacheSize” nodes and numer of children in “configuration/childLimit”.

Thanks to: http://sitecoreblog.patelyogesh.in/2013/08/speedup-sitecore-startup.html

Initialize SPEAK Pipelines

Sitecore SPEAK has defined pipelines which precompile the SPEAK files.  If they will not be compiled on start, they will be compiled during the page loading. So it easy to decide to disable precompile pipelines on developer machine.

To disable this pipelines you should comment out (patch of course would be better):

// App_Config/Include/Sitecore.Speak.config

<initialize>
<!--  
<processor type="Sitecore.Pipelines.Initialize.PrecompileSpeakViews, Sitecore.Speak.Client">
 <Paths>/sitecore/shell/client/Business Component Library</Paths>
 </processor>
-->
 </initialize>

// App_Config/Include/ContentTesting/Sitecore.ContentTesting.config

<initialize>
<!--
<processor type="Sitecore.Pipelines.Initialize.PrecompileSpeakViews, Sitecore.Speak.Client" use="ContentTesting">
 <Paths>/sitecore/shell/client/Applications/ContentTesting</Paths>
 </processor>
-->
 </initialize>

Thanks to: http://kamsar.net/index.php/2015/02/sitecore-8-experience-editor-performance-optimization/

You can do it by yourself or use SIM “Configuration – Sitecore 8 – Development – Initialize Speed Booster” (here you can find configuration file: click).

Change mode of initialization for ApplicationPool

Inside directory

%windir%\System32\inetsrv\config

you will able to find file “applicationHost.config”. Inside that file in node “/configuration/system.applicationHost/applicationPools” you will find definitions of pools for your applications. You should set startMode to “AlwaysRunning”, so your configuration may looks like this one:

<add name="$NAME" autoStart="true" enable32BitAppOnWin64="false" managedRuntimeVersion="v4.0" managedPipelineMode="Integrated" startMode="AlwaysRunning">
 <processModel identityType="ApplicationPoolIdentity" pingingEnabled="false" />
 </add>

You can also change this from IIS and pool advanced configuration.

The second think you could change is in node “/configuration/system.applicationHost/sites”. Find your site and “application” definition, then add/set there an attribute “preloadEnabled” to “true”. Your configuration may looks like this one:

<site name="$NAME" id="6" serverAutoStart="true">
 <application path="/" preloadEnabled="true">
 <virtualDirectory path="/" physicalPath="$PATH" />physicalPath="$PATH" />
 </application>
 <bindings>
 <binding protocol="http" bindingInformation="*:80:$NAME" />
 </bindings>
 <applicationDefaults applicationPool="$NAME" />
 </site>

This setting makes your website always ready to display.

Thanks to : http://blogs.iis.net/wadeh/application-initialization-part-2

Disable Ilde Time-out Action in IIS

By default your iis terminate applications which are not in use for defined time. But when you are working on your application you definitely want to have your application ready all the time.

Find your application pool inside IIS and:

  • in recycle settings (first view) clear all checkboxes
  • in advanced settings find “Idle Time-out (minutes)” and set it to 0

Then go to the website advanced configuration (also in IIS) and change “Connection Time-out” to 0.

Restart IIS and your environment is ready.

Thanks to: https://dotnettimes.wordpress.com/2014/03/24/fixing-slow-initial-load-for-iis-web-site/

Disable Event Queue

You can disable some event queues because they are not required for developers use.

Just add the following line in “/configuration/sitecore/settings” node:

<setting name="EnableEventQueues" set:value="false" />

You can do it by yourself or use SIM “Configuration – Sitecore 8 – Development – Disable Event Queue” (here you can find configuration file: click).

Happy speeding up! 🙂

If you have other tips, please share them in comments – i will update post.

First in Poland Sitecore Meetup

20 may 2016 will go down in history as day of first in Poland Sitecore meetup.

I have a pleasure to be an organizer of this event. In cooperation with our sponsors (Coders.Center & Sitecore) we are trying to build community of Sitecore users in Poland.

On first meetup our speakers are going to talk about:

  • Sitecore XP – more than CMS – about platform capabilities in support of online marketing (Jakub Koba)
  • Sitecore xDB – Architecture and Configuration (Tomasz Juranek)
  • Sitecore & Gulp as a way of automatization in Siteore projects (Radosław Kozłowski)

If you want to be a part of this event here you can find more information:

Presentations from Meetup:

If you want to join to our community, here you are able to find more information:

 

Arrow Code

Today i have decided to share with you another well known problem – “the arrow code”.

Many of unexperienced software developers write code in following way:

if
  if
    if
      if
        do something
      endif
    endif
  endif
endif

In first moment it probably does not look as error but when we would add more logic to this, this code would be very hard to maintain.

That is why you should read this article: click