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" 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>
view raw Web.config.transform hosted with ❤ by GitHub
  • 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/" xmlns:environment="http://www.sitecore.net/xmlconfig/environment/">
<sitecore>
<watchers environment:require="!DEV">
<patch:delete />
</watchers>
</sitecore>
</configuration>

Happy Sitecoring!

By Sebastian Tecsi

Sitecore MVP 2018, 2019, 2020, 2021
Sitecore Architect

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

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