Over the last few weeks we’ve had an increase in queries relating to improving site, and page, performance. A lot of these have related to how Google’s page audit tool analyses site pages.
As we host websites for our customers, providing some insight covering what these are, and how they can be improved and how we’re involved in what’s audited seems appropriate.
There are two aspects that Google’s page audit tool covers:
- The speed at which the page is served.
- The content of the page that is served.
As your hosting provider, we’re only involved in the speed at which the page is served, but have no oversight over the page content that’s served. Even then, the speed side of things isn’t something that we completely control.
Whilst we do what we can to reduce page load times specific to the server aspect, and provide underlying object caching such as Redis and Memcached, and allow the use of GZip compression, what’s operated on the site does also have an impact on page load times (such as the number of plugins in use in the context of WordPress). The other thing to bear in mind is that the object caching and the use of compression is there to be used, but whether these are used or not, is ultimately controlled by how websites are operated.
GZip Compression
Many caching plugins will provide the option to enable compression, and this can also be bought in to effect manually by adding this to your site’s .htaccess file:
<IfModule mod_deflate.c>
# Compress HTML, CSS, JavaScript, Text, XML and fonts
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
AddOutputFilterByType DEFLATE application/x-font
AddOutputFilterByType DEFLATE application/x-font-opentype
AddOutputFilterByType DEFLATE application/x-font-otf
AddOutputFilterByType DEFLATE application/x-font-truetype
AddOutputFilterByType DEFLATE application/x-font-ttf
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE font/opentype
AddOutputFilterByType DEFLATE font/otf
AddOutputFilterByType DEFLATE font/ttf
AddOutputFilterByType DEFLATE image/svg+xml
AddOutputFilterByType DEFLATE image/x-icon
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/xml
# Remove browser bugs (only needed for really old browsers)
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
Header append Vary User-Agent
</IfModule>
This instructs the web server to compress your site’s pages output, and it’s then decompressed by browsers accessing your site. The total data transferred over the wire is less due to the use of this compression method, and due to this, the page is effectively downloaded in a lesser amount of time.
Object Caching
Object caching is a method whereby commonly used parts of your site are cached, and then served when pages are requested, rather than entire code execution being required to generate page output.
Both Redis and Memecached are available across our shared hosting platform, but your site needs to make use of these to gain any benefit from them (their presence alone doesn’t mean they’ll be automatically used). In the context of WordPress there are a variety of plugins that can be used to bring object caching in to effect. The W3 Total Cache plugin can be configured to use Redis or Memcached as can the Redis Object Cache plugin (for Redis) and the Memcahed Object Cache Plugin (for Memcached).
The settings you’d need to use in your chosen plugin are:
Redis settings:
Server address: 127.0.0.1
Port: 6379
There’s no need to define a username or password.
Memcached settings:
Server address: 127.0.0.1
Port: 11211
There’s no need to define a username or password.
Further improvements may be made by streamlining your site, by involving less components in the site itself. In the context of WordPress or Joomla the simplest way of carrying out this type of streamlining is by reducing the number of plugins (WordPress) or Components (Joomla).
The main thing to bear in mind is that a WordPress or Joomla installation as a whole make up a web application. The web application is executed as a whole (including all plugins/components) when a page is requested. The more plugins or components your site has, the more code is executed, and this has to take place before page output is generated. Consequently reducing the number of plugins or components reduces the amount of code execution, and is therefore likely to reduce page load times.
The effect that all of the above is likely to have is a reduction in server response time. After all, a page has to be requested, and site code executed, before page output can be generated.
Page Output Based Audits
Although what’s mentioned above may well help with some aspects of Google’s page audits, this is one part of a bigger picture. The main aspect that’s audited is the page output itself. As a hosting provider we have no control over the page output that’s generated. Page output is generated by the site you’ve deployed, the components that make up your site and how these function, rather that being specific to the web hosting servers themselves.
Although providing advice covering the page output side of things isn’t the easiest thing to do for us (due to the variable nature of how sites are created and the components they use) some general advice would be as follows:
- Ensure you’re following basic SEO guidelines such as alt tagging images, using meta descriptions, and using <title> tags. Google’s SEO starter guide can be found here if you need advice in this capacity.
- Deploy a security policy for your site. The W3 Total Cache plugin can be used to define a security policy, or for a more “one click” alternative the Headers Security Advanced & HSTS WP plugin can be used.
- Use next generation images such as webp or AVIF. Numerous plugins are available to batch convert existing images if you’re looking to optimise and existing site.
- If you’re using Google fonts, host them locally as this reduces external calls, the related DNS lookups, and can reduce the amount of Javascript your site uses.
- Reduce the weight of your site’s pages by reducing the size of the Document Object Map (page HTML).
- Ensure that the size of your site’s pages aren’t over around 1.5MB (at the most).
- Minimise the use of external resources being used, such as iFrames or plugins that pull information from external sources (Review widget plugins for example) as this often involves not only what you see, but additional Javascript specific to what’s being called externally being involved in your page output.
Beyond the above, it’s generally a case of using page analysis tools such as Google’s page audit tool, Gtmetrix and Pingdom to check to see what audits are failing, then looking at your page output to find out what the problem is, then taking measures to address the issues from within your content management system that you’re using to run your site.