/ Performance

Spice up Sitecore Performance with IIS

Let's walk through quick and easy ways to improve Sitecore Performance at the IIS level. The tips and tricks are mostly used when we setup a new environment.

The changes mentioned will need IIS reset to take effect use with caution.

Compression helps in reducing the payload transferred to the client browser. Reduce in size, increases faster transfer and helps load the website faster.

Select the site and click the compression.

Enable both the compressions available.

When you try to check the compression, it might show Dynamic compression as checked and grayed out. In that case the feature is not installed.

The Compression role should be installed at the server role as follows.

Compression Types
IIS supports multiple types of compression. The widely used one for a long time is Gzip. IIS has set the default compression scheme provider as Gzip, supports both Gzip and Deflate compression. It is registered as the Gzip scheme in applicationHost.config.

Brotli is a new standard that provides better compression than gzip it is supported by all major browsers. The compression algorithm is developed by Google and widely used.

Brotli performance when compared to gzip, might not look that big but when browsing on a mobile phone everything counts.

  • 14% smaller for JavaScript
  • 21% smaller for HTML
  • 17% smaller for CSS
    Ref Akamai

Can I use Brotli?


Ref: https://docs.microsoft.com/en-us/iis/extensions/iis-compression/iis-compression-overview

Script Install
Automated install script for easy install on multiple servers. Save the installer and this script in the same folder and execute as administrator. The powershell script will install and configure Brotli compression prioritizing over Gzip.

Manual Install
Backup the application host config from the following location before any updates.


Download the Microsoft IIS Compression release and install the appropriate package.
Microsoft IIS Compression (x86) here.

Microsoft IIS Compression (x64) here.

By default, the Gzip is listed as the first supported compression in the request header. Looking at this the server will use the Gzip scheme.

We will use the hack to overcome and priorotize Brotli over Gzip if the browser supports. Create the following rewrite rule at the Site level

Pattern: .*
Conditions: {HTTP_ACCEPT_ENCODING} \bbr(?!;q=0)\b
Server variable: HTTP_ACCEPT_ENCODING br

Ref: Server fault answer

The content encoding in response header will be br when it uses the Brotli compression.

Time to Live (TTL)
By default TTL will not be enabled and all the content will be downloaded every time from the server, this will affect the performance. Enable default TTL at the IIS level between 7-30 days or more.

Media library Item TTL is set at Sitecore level, default value is 7 days that can be increased by using the following patch.

App Pool Timeout
Ensure the production Idle Time-out is set to 0.

App Pool Recycling
Disable the default recycling on regular intervals.

HTTP/2 support is available in Windows 10 and Windows Server 2016. HTTP/2 is a major upgrade after nearly two decades of HTTP/1.1 use and reduces the impact of latency and connection load on web servers. In HTTP/2, a persistent connection can be used to service multiple simultaneous requests with several additional features that improve the efficiency of HTTP over the network.

If you are using a load balancer this has to be enabled on that network device.

By default http/1.1 can do only 6-8 simultaneous connection depending on the browser.
The following image you can see the waterfall in the last column multiple connection at the same time due to h2 protocol.

Photo by Christian Englmeier on Unsplash