Categories
Performance Sitecore

Performance: disable Sitecore watchers in Azure webApp

I order to improve performance of a Sitecore solution that is hosted in Azure webApp its recommended to remove the Sitecore FileWatchers.

Sitecore FileWatchers are “watching” various folders in the disk for changes (delete, create, rename) and this process is consuming in Azure webApps and prone to instance restarts.

All FileWatchers in Sitecore are defined in the Web.config under /configuration/system.webServer/modules:

Web.Config FileWatchers.

As all Sitecore FileWatchers are in fact HTTP Modules.

Beside that section in Web.config, all FileWatchers are also reading various settings from Sitecore configuration.

Sitecore Config File Watchers

So, in order to have better stability of your Sitecore instance is needed to disable all the Sitecore FileWatchers as follows:

  • remove the definition of the FileWatchers from web.config file for your needed environment with config transformation at the build/release/deploy time
<?xml version="1.0"?>
<!– For more information on using Web.config transformation visit https://go.microsoft.com/fwlink/?LinkId=301874 –>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform&quot; xmlns:asmv1="urn:schemas-microsoft-com:asm.v1">
<system.webServer>
<modules>
<add type="Sitecore.Resources.Media.UploadWatcher, Sitecore.Kernel" xdt:Locator="Match(type)" xdt:Transform="Remove" />
<add type="Sitecore.IO.XslWatcher, Sitecore.Kernel" xdt:Locator="Match(type)" xdt:Transform="Remove" />
<add type="Sitecore.IO.LayoutWatcher, Sitecore.Kernel" xdt:Locator="Match(type)" xdt:Transform="Remove" />
<add type="Sitecore.Configuration.ConfigWatcher, Sitecore.Kernel" xdt:Locator="Match(type)" xdt:Transform="Remove" />
</modules>
</system.webServer>
</configuration>
  • remove the definition of watchers from Sitecore.config file using a patch config file. Here is an example:
<?xml version="1.0" encoding="utf-8" ?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/&quot; xmlns:environment="http://www.sitecore.net/xmlconfig/environment/"&gt;
<sitecore>
<watchers environment:require="!DEV">
<patch:delete />
</watchers>
</sitecore>
</configuration>

Happy Sitecoring!

By Sebastian Tecsi

Sitecore MVP 2018-2021
Sitecore Architect

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.