Page Speed – The Smaller 7th Pillar – Micro Boosts

You may have read my previous blog post: One Performance Blog to Rule them all – Combining the 6 Pillars of Speed

This is just a quick update to list out some further optimisations that might help you achieve a few extra points.


Prolong the Cache Expiry Setting

The default cache expiry settings is 7 days OOTB in Sitecore. This is a little short for the likes of GTMetrix but may be passable for Lighthouse. I found it best to bump it up to 30 days (if you can).

<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:set="http://www.sitecore.net/xmlconfig/set/">
  <sitecore>
      <settings>
	  <setting name="MediaResponse.MaxAge" set:value="30.00:00:00"/>
      </settings>
  </sitecore>
</configuration>

Web.config and applicationHosts.config changes

These three changes are from a blog written by Sergio Gisbert

1) Add the ‘Accept-Encoding’ header to responses:

<httpProtocol>
    <customHeaders>
        <remove name="Vary"/>
        <add name="Vary" value="Accept-Encoding"/>
    </customHeaders>
</httpProtocol>

2) Enable Dynamic compression on IIS (this should already be done if you followed the Sitecore setup document) and then add in specific mime types that need coverage to web.config.

<httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files">
    <scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" />
    <dynamicTypes>
        <add mimeType="text/*" enabled="true" />
        <add mimeType="message/*" enabled="true" />
        <add mimeType="application/javascript" enabled="true" />
        <add mimeType="application/x-javascript" enabled="true" />
        <add mimeType="application/json" enabled="true" />
        <add mimeType="image/jpeg" enabled="true" />
        <add mimeType="image/jpg" enabled="true" />
        <add mimeType="image/gif" enabled="true" />
        <add mimeType="image/png" enabled="true" />
        <add mimeType="application/vnd.ms-fontobject" enabled="true" />
        <add mimeType="application/x-font-truetype" enabled="true" />
        <add mimeType="image/svg+xml" enabled="true" />
        <add mimeType="*/*" enabled="false" />
    </dynamicTypes>
    <staticTypes>
        <add mimeType="text/*" enabled="true" />
        <add mimeType="message/*" enabled="true" />
        <add mimeType="application/javascript" enabled="true" />
        <add mimeType="application/x-javascript" enabled="true" />
        <add mimeType="image/jpeg" enabled="true" />
        <add mimeType="image/jpg" enabled="true" />
        <add mimeType="image/gif" enabled="true" />
        <add mimeType="image/png" enabled="true" />
        <add mimeType="application/vnd.ms-fontobject" enabled="true" />
        <add mimeType="application/x-font-truetype" enabled="true" />
        <add mimeType="image/svg+xml" enabled="true" />
        <add mimeType="application/json" enabled="true" />
        <add mimeType="application/x-woff" enabled="true" />
        <add mimeType="*/*" enabled="false" />
    </staticTypes>
</httpCompression>

3) Update applicationHosts.config to compress SVG and JSON payloads. As Sergio mentions in his blog this has to done in applicationHosts.config. (great find Sergio)

<add mimeType="image/svg+xml" enabled="true" />
<add mimeType="application/json" enabled="true" />

GZIP your main HTML document

Google Page Speed insights calls this criteria “Text Compression” but this does actually make a download size difference if your HTML payload is large. After doing this I witnessed my initial HTML delivery drop from 130KB to 40KB.

Inside your web.config and the <httpCompression> tags we added just previously add the mimeType for document into both staticTypes and dynamicTypes.

<add mimeType="document" enabled="true" />

Cleanup all missing fonts and 404s

Be sure to check you network tab and make sure any missing font references or external resources are not throwing 404s. This will result in a score reduction particularly on GTMetrics.

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

%d bloggers like this: