Performance tuning of Sitecore SPEAK components

Hi Champs,

Today I am going to explain you how you can reduce the time taken for loading by SPEAK components in your Sitecore application.

In order to reduce load time of SPEAK components after website modification, you can alter the compilation element in the web.config by adding the optimizeCompilations attribute to it as follows:

<compilation ...  optimizeCompilations="true">

Actual Implementation in web.config file looks like:

c

Adding this attribute will make ASP.NET re-compile only the files that were explicitly changed and leave all the other files intact.

Please note that if optimizeCompilations is true, you might encounter some issues during development after re-compilation. According to the MSDN article

When you change a top-level file only the affected files are recompiled. This saves time but can cause run-time errors depending on the type of changes you make to a top-level file.

Please check the Optimizing Dynamic Compilation part of the a aforementioned article for more details.

Happy Learning Sitecore !!!!

Advertisement

Check out your CD Solr indexing in Sitecore Azure PaaS Scaled Environment

Hi Champs,

Today I am going to talk on miss-configuration which sometime comes in CD role for Indexing strategy.

There was a scenario which recently I came across that from CD role in Azure PaaS Scaled environment Indexing was getting triggered which is wrong as indexing has to be triggered from CM role ideally. So below are the details of entire case study.

Cloud Environment: Sitecore Managed Cloud (XP-Small and XP-Medium)

Cause of the issue: By default indexing strategy was set to “onPublishEndAsyncSingleInstance” in CD role.

After investigating 10 days with Sitecore support and Product services team we found that indexing strategy was set to “onPublishEndAsyncSingleInstance” which was causing excessive DTU usage. This was set for below.

  1. sitecore_web_index
  2. sitecore_fxm_web_index
  3. sitecore_marketing_asset_index_web
  4. sitecore_marketingdefinitions_web

Solution: I created a patch file for setting indexing strategy to Manual for all above from CD role. As all these are getting rebuild properly from CM role.

Patch file: Patch file has below configurations. Note this has to be added only on CD role.

<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
  <sitecore>
    <contentSearch>
      <configuration>
        <indexes>
          <index id="sitecore_web_index">
            <strategies>
              <strategy>
                <patch:delete />
              </strategy>
              <strategy ref="contentSearch/indexConfigurations/indexUpdateStrategies/manual" />
            </strategies>
          </index>
          <index id="sitecore_fxm_web_index">
            <strategies>
              <strategy>
                <patch:delete />
              </strategy>
              <strategy ref="contentSearch/indexConfigurations/indexUpdateStrategies/manual" />
            </strategies>
          </index>
          <index id="sitecore_marketing_asset_index_web">
            <strategies>
              <strategy>
                <patch:delete />
              </strategy>
              <strategy ref="contentSearch/indexConfigurations/indexUpdateStrategies/manual" />
            </strategies>
          </index>
          <index id="sitecore_marketingdefinitions_web">
            <strategies>
              <strategy>
                <patch:delete />
              </strategy>
              <strategy ref="contentSearch/indexConfigurations/indexUpdateStrategies/manual" />
            </strategies>
          </index>
        </indexes>
      </configuration>
    </contentSearch>
  </sitecore>
</configuration>

Happy Indexing

MVC Pre-compiled views in Sitecore 9XP for Azure PaaS

Hi Champs,

Today I am going to explain quick learn for usage of Pre-complied view in Sitecore 9XP. Enabling Pre-compiled MVC views gives boost to performance in Azure PaaS environment, it is considered as one of the performance tuning parameter in  Sitecore Azure PaaS environment and Sitecore Managed Cloud.

By pre-compiling views you will benefit from the following:

  • Compile time checking of errors. Usually, Razor files are compiled when they are first required. By pre-compiling your Razor views you remove the source of runtime bugs.
  • Faster load time. The SitecoreRazorViewEngine will start to load your views from an assembly (.dll file) rather than a view (.cshtml file).
  • Once the Razor-Generator is Configured for your Visual Studio Solution you can follow below steps
  • To enable Razor-Generator Check this link.

Perform the following to pre-compile MVC views:

  1. Go to the below folder path. wwwroot\youewebsitefolder\App_Config\Sitecore\Mvc
  2. Here you will find the config file with the name Sitecore.Mvc.config”
  3. In this file search for term “<precompilation>”.
  4. And under <precompilation> node add below configuration highlighted in green. don’t forget to change the name to your assembly name.                                                                                                       <precompilation>
        <assemblies>
            <assemblyIdentity name=”Sitecore.Mvc” />
            <assemblyIdentity name=”YourAssemblyName” />
        </assemblies>
    </precompilation>

Happy Learning Sitecore !!!!