Server response time also known as time to first byte (TTFB) is generally always high on WordPress websites that haven’t been optimised for performance.
In this tutorial we will show you how to improve your server response time that’s often flagged by Google’s Pageinsight tool with a few simple steps.
Results
- Average WordPress Time to First Byte: 700ms
- After Implementing changes from this tutorial: 10ms
Step 1: Download & Install W3 Total Cache Plugin
To do this you will need to head over to your plugins section within your WordPress admin panel, as seen below.
Now search for ‘W3 Total Cache’ the first resulted, highlighted in red below is the plugin we need to install and activate.
Once activated, you should see ‘Performance’ appear within your admin panel on the left hand side. Hover of this and select ‘General Settings’ as shown below.
Within the W3 Total Cache General Settings page, you will find multiple modules, we require ‘Page Cache’ which should be the second module displayed.
Tick the enable box and leave method set to ‘Disk: Enhanced’, as seen below.
Select ‘Save Settings & Purge Caches’.
Congratulations, your server response time has now been fixed. Generally you should expect to see server response time drop from 400ms + to under 50ms.
Although your server response time has been fixed, it will only be fast as long as it’s cached. The default expiry times for cache is too low within W3 Total cache. In order to maximise our websites performance. We need to improve this.
Step 2: Increasing page cache expiry times
Within the Performance / W3 Total Cache navigation click on ‘Page Cache’.
Scroll down until you find ‘Garbage collection interval’ which sits within Advanced, highlighted below.
The default value is 3600 seconds which equates to 1 hour. This means every hour your cache will be purged. This will mean the next user/bot that visits your website will receive an uncached version of your website, resulting in a high server response time.
Note: leaving the value set to default (3600) for low traffic websites could hinder SEO performance.
In order to prevent any users or bots such as Googlebot from seeing an uncached version of the website, we need to increase this to 24 hours which is 86400 seconds.
Step 3: Warming The Page Cache
In order for WordPress to automatically warm up the cache, we need to enable ‘Cache Preload’. What this does is crawl the website every X amount of time to ensure all pages have a cached version. If they don’t, it will generate one on the fly. This will result in stable server response times with minimal fluctuation.
In order to enable this, we must navigate to the ‘Page Cache’ page once again and this time we need to scroll down and find ‘Cache Preload’.
Tick both automatic and preload boxes as seen below. Within the Sitemap URL, enter your sitemap index file. If you do not have one, please see our Yoast SEO plugin article that covers how to create an XML sitemap.
Once you have entered your full Sitemap index URL. We need to tweak the ‘Update Interval’ and ‘Page per Interval’ settings.
It is important to stress that the numbers will vary depending on the size of the website and if you are on shared hosting or dedicated hosting. We have prepared some settings below that may help guide you in the right direction.
Shared Hosting
- Under 100 articles
- Pages per interval: 50
- Update Interval: 3600 seconds
- Under 200 articles
- Pages per interval 100
- Update Interval: 3600 seconds
- Under 500 articles
- Pages per interval: 250
- Update Interval: 3600 seconds
Dedicated Hosting
- Under 500 articles
- Pages per interval: 500
- Update Interval:3600 seconds
- Under 5,000 articles
- Pages per interval: 2,500
- Update Interval: 3600 seconds
- Over 5,000 articles
- Pages per interval: 5,000
- Update Interval: 3600 seconds
All the settings shown above will crawl X amount of pages ever hour (3600 seconds). This will ensure the entire website is fully cached, resulting in super fast and stable server response times (Time To First Byte).