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

Azure worker reset module for Sitecore PaaS

Azure

Hi Champs,

Today I am going to introduce my new Module for Sitecore Azure PaaS. This module is called Azure Worker Exchanger details for this are as below.

What is Azure Worker Exchanger?

Azure Worker Exchanger Module is a facility created in association with Microsoft Azure Worker API to kill and replace any of the corrupt or non-performing workers created in Azure PaaS. This module should be used only when any worker process is showing a spike in performance and behaving abnormally or got corrupted, to analyze these below are the symptoms.

  1. Website loading slowly.
  2. Some of the users are not able to visit the website.
  3. Azure is throwing many alerts for performance issues.
  4. Azure matrics showing spikes for performance.

How to use this Module?

  1. Download the Module here.
  2. Install on CM role with Sitecore Package Installer.
  3. Once done you can navigate to the below URL to find the Form.
    https://yourdomain/InstanceExchanger.aspx
  4. Once the form is open you need to supply few details about your Azure Web app. (These are very simple and exactly as mentioned in below photo)
  5. Once you filled the form submit it.
  6. You will get a response message back.
  7. After that wait for 5-10 minutes for Azure to settle everything.
  8. Once everything is settled you need to go to the Azure Web app and open a kudu to see a new worker created with new underlying resources.

Happy Learning !! Keep Learning !!

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

Disabling ARR’s Instance Affinity in Sitecore Azure Websites

Azure

Hi Champs,

Today I am going to help you in different aspect of scaled environment in Azure where I will explain what is ARR in scaled Sitecore Azure instances. So without delaying we will start this with below pointer which will explain all the things related to this.

What is ARR Affinity?

Application Request Routing (ARR) is a feature where when a client (or browser) request to any Azure based website, a cookie will be created and stick to the first time request received web site instance.

The same cookie will be used for subsequent requests from this client or browser and these requests will be guided to the same web site instance the one which was served for the first time.

Advantages:
With this feature, we can get an advantage if in case the web site instance is maintaining lots of data in it’s memory and moving the subsequent requests to other instance leads to copy entire data to other instance and this is a more performance and pain to the system.

Dis-Advantages:
We can see many disadvantages when compared with advantages. If a client request and unfortunately the sticky instance is not available, this request cannot be guided to any other available instance instead it will send an unavailable message to the client.

Also, In case if an instance is a too much load with other request and this request will be in request queue instead can guide to other instance to balance the load.

How ARR Affinity works?

  1. Client connects to an Azure Web Sites website
  2. ARR runs on the front-end Azure server and receives the request
  3. ARR decides to which of the available instances the request should go
  4. ARR forwards the request to the selected server, crafts and attaches an ARRAffinity cookie to the request
  5. The response comes back to the client, holding the ARRAffinity cookie.
  6. When the client receives the request, it stores the cookie for later use (browsers are designed to do this for cookies they receive from servers)
  7. When the client submits a subsequent request, it includes the cookie in it
  8. When ARR receives the request, it sees the cookie, and decodes it.
  9. The decoded cookie holds the name of the instance that was used earlier, and so ARR forwards the request to the same instance, rather than choosing one from the pool
  10. The same thing (steps 7-9) repeat upon every subsequent request for the same site, until the user closes the browser, at which point the cookie is cleared
8407.blogpicture.png-550x0
 
This is how the affinity cookie looks:
 
5773.bp2.png-550x0
 

Disabling the affinity can be done in different ways: (Every one prefer that last way explained)

  1. In your application
    To control this behavior in an application, you need to write code to send out a special HTTP header, which will tell the Application Request Router to remove the affinity cookie. This header is Arr-Disable-Session-Affinity, and if you set it to true, ARR will strip out the cookie. For example, you could add a line similar to this to your applications’ code: 
     
    headers.Add(“Arr-Disable-Session-Affinity”, “True”);
     
  2. In a site configuration
    If you prefer to have it completely disabled, you could have ARR remove the cookie always by having IIS itself inject that header directly. This is done with a customHeaders configuration section in web.config. Simply add the following into your web.config, and upload it to the root of the site: 

6765.bp3.JPG-550x0 

There is one more way yo disable this is which require us to follow below steps.
  1. Go to Azure App service.
  2.  Then go to Configuration.
  3. In configurations you will find General settings tab click on it.
  4. Here in this tab you will find the Sections called Platform settings.
  5. In this sections you will find the ARR affinity radio button.
  6. As per requirement you can disable it.(by default this is on)

ARR

To test this you need to go into HTTP header and check the value is coming or not. Another simple way is once you disabled it you can clear your browser cookies and load the website again and check in cookies sections and you will find that ARR cookie is not created.

Happy Learning!!!!

Globalization Setting Sitecore PaaS and SMC

Hi Champs,

Today I am going to give you quick quick learning details about how you can setup default Culture of your Sitecore Application.

First question which will get raised why you want set  this?(specifically in Azure PaaS and Sitecore Managed Cloud)

Answer to this question is now a days we host Sitecore application in Azure PaaS or any Other Cloud offerings where the actual Timezone and Culture is different. In this case the impacts will come to few part off your application where your using default culture settings in application globalization. Which means miss match of time/date formats etc.

Next question will be How we can fix it ?

So the answer is as below.

  1. Go to your Sitecore application.
  2. Open Web.config.
  3. Serch for below term.                                                                                          “<globalization”
  4. You will find a predefined setting with few attributes but you can set few more attributes like below to set default Culture of your application.
<globalization requestEncoding="utf-8" responseEncoding="utf-8" enableClientBasedCulture="false" culture="en-GB" uiCulture="en-GB" />

Note:

  1. This setting is totally different than the Time Zone setting for Sitecore application.
  2. What I mean over here is even if you set Time Zone to the one which you want in Cloud still you will get issues with formats.
  3. So this settings will help all those issues in Sitecore.
  4. This settings is tested of in Azure PaaS and Sitecore Managed Cloud.

Happy Learning