Need to reduce server response times in PageSpeed Insights?
Servers are controlled by your hosting. The easiest way to reduce server response times in WordPress is to upgrade to a more powerful server since shared hosting has strict CPU limits. Also try using a CDN to offload resources, remove high CPU plugins, and clean your database.
Shared hosting (GoDaddy, Bluehost, HostGator) has insufficient server resources and have trouble running high CPU tasks like WooCommerce, Elementor, Divi, or AdSense. Moving to faster cloud hosting should fix this immediately. Otherwise, you need to lower CPU usage and lighten the load on your server. SiteGround has one of the worst TTFBs as reported Backlinko.
What Is A Good TTFB?
Google recommends a TTFB of under 200ms.
This can be realistic for many sites, but you need to have a fast infrastructure (hosting, theme, plugins, etc). Anything over 500ms is slow considering everything else your site needs to load.
With how much speed affects SEO and user experience, TTFB has become one of the most important items when optimizing WordPress. The lower you can get your TTFB, the better.
1 | 2 |
---|---|
0-200ms | Google Recommended |
200-400ms | Average |
400-600ms | Slow |
800-800ms | Very Slow |
800-1000ms | Unacceptable |
1000ms+ | Garbage |
Reduce Server Response Times (TTFB) In WordPress
- Test For Slow TTFBs
- Ditch Shared Hosting
- Upgrade To Cloud Hosting
- Keep An Eye On CPU Usage
- Eliminate High CPU Plugins
- Disable WordPress Heartbeat
- Don’t Combine CSS + JavaScript Files
- Avoid Page Builders
- Cache Everything In Cloudflare
- Reconfigure Your CDN
- Clean Up Your Database
- Delete Unused Themes + Plugins
- Configure A Solid Cache Plugin
- Block Unwanted Bots
- Update To PHP 7.4
- Increase Memory Limit To 256MB
- Update WordPress Core, Theme, Plugins
- Use A Premium DNS
- Optimize Third-Party Code
1. Test For Slow TTFBs
Measuring TTFB In PageSpeed Insights
PageSpeed Insights is a good place to measure TTFB. According to Google, “this audit fails when the browser waits more than 600 ms for the server to respond to the main document request.”
Measuring TTFB In GTmetrix
GTmetix shows your TTFB in the Summary and Structure tabs. Sign up for a free GTmetrix account so you can run tests from the data center closest to your visitors instead of Vancouver.
Measuring TTFB In KeyCDN
KeyCDN measures TTFB across 14 different locations (it’s also my preferred tool). TTFBs can be fast when testing locations close to your origin server and slow when testing long distances.
Measuring TTFB In Pingdom
Pingdom measures TTFB as “wait” time and also lets you test from various locations.
Measuring TTFB In Chrome DevTools
Chrome DevTools measures TTFB but is also affected by your computer’s latency and internet connection, so you may want to measure TTFB from a data center using one the tools above.
2. Ditch Shared Hosting
Shared hosting is infamous for slow TTFBs.
If your neighbors (other sites on the server) are hogging resources, your website is being starved. Not to mention shared hosting always has CPU limits. That’s why you’ll often see 500 errors on shared hosting. One day your website is fast, the next day, it’s sluggish. I would never run a page builder or WooCommerce with shared hosting – they demand too many resources.
- SiteGround – Backlinko found SiteGround had one of the slowest TTFBs. There has also been increased complaints about slow TTFBs in Facebook Groups, CPU limits, recent server issues, and their cloud hosting usually won’t fix your TTFB (demo site is slow when using Astra on SiteGround GrowBig: stgrndserver.com). Many SiteGround customers already left as they rapidly went downhill in 2020.
- GoDaddy – long reputation for slow hosting and generally a bad provider.
- Bluehost – popular with affiliates, but not recommended in Facebook Groups.
- HostGator – same company as Bluehost (EIG) with mostly the same problems.
- Hostinger – uses LiteSpeed which is faster, but still not fast and very unethical.
Cloud hosting makes a difference.
Join the WordPress Hosting Facebook Group to get unbiased opinions. Other Facebook Groups like WordPress Speed Up may be moderated by SiteGround’s community manager where posts get removed if they speak negatively about SiteGround, and opinions are biased.
Here’s a TTFB test I did on 16+ hosts using the same Astra Starter site (read about the test).
3. Upgrade To Cloud Hosting
Most people in the WordPress Hosting Facebook Group swear by Cloudways.
Specifically, their DigitalOcean and Vultr High Frequency plan (I use DigitalOcean).
Do your research and look at this thread (or this one).
Yes, it’s a little more expensive at $10-$13/month, but we’re talking about speed here – not being cheap. With Cloudways, you have a choice of using DigitalOcean, Vultr High Frequency, Google Cloud, AWS, or Linode. These are worlds faster than shared hosting and can handle resource-intensive tasks much better (Elementor, Beaver, Divi, WooCommerce, AdSense, etc).
Cloudways makes it easy to test them out and see the difference in your load times: they do free migrations, monthly pricing, a Migrator plugin, and a promo code to save money: OMM25
People who moved to Cloudways and reported faster TTFBs/load times (including me):
Recent Facebook polls show a large shift in people moving away from lower quality hosts (especially SiteGround) to Cloudways, Kinsta, A2, and GridPane. Oh, how things have changed.
Affiliate Disclaimer – if you sign up for Cloudways using my affiliate link, I would seriously appreciate it. I don’t recommend bad hosting like many other affiliates. I also donate quite a bit to charity ($6,000 to GoFundMe so far) and your support would really help. I try to base my reviews not only from my experience, but real evidence from the overwhelming feedback in numerous Facebook Groups. It would mean a lot.
4. Keep An Eye On CPU Usage
Check your hosting account to make sure you’re not maxing out your CPU limits. Try to never exceed 80% of your limits so your server stays relaxed. On cloud hosting, you can add more CPU + RAM which will help, and on shared hosting you will have to upgrade your plan. But before you do, follow this guide as it should also help you reduce CPU consumed by your site.
That’s why it’s so important to choose a plan with enough server resources. Host companies give you guidelines based on your monthly visitors, but they don’t take into account how many plugins you have, whether they consume lots of resources, and whether you’re using a CDN.
5. Eliminate High CPU Plugins
*Most slow WordPress plugins include social sharing, statistic (analytics), sliders, portfolios, page builders, calendars, chat, contact forms, related post, sitemap, Wordfence, WPML, WooCommerce, and any plugin that runs ongoing scans or processes. These can be identified using Query Monitor or Waterfall in GTmetrix.
- AddThis
- AdSense Click Fraud Monitoring
- All-In-One Event Calendar
- Backup Buddy
- Beaver Builder
- Better WordPress Google XML Sitemaps
- Broken Link Checker
- Constant Contact for WordPress
- Contact Form 7
- View Full List Of 73 Slow Plugins
Find Your Slowest Plugins – Query Monitor and New Relic are great for finding slow plugins. Install Query Monitor, view a page on your site, hover over the Query Monitor tab, and go to Queries > Queries By Component. You should check multiple pages/posts for different queries.
WP Hive is a nifty Google Chrome Extension that tells you whether a plugin will impact your memory usage / PageSpeed Insights scores when viewing plugins in the WordPress repository.
Lightweight Plugin Alternatives
- SEO – Rank Math.
- Backups – UpdraftPlus.
- Sliders – Soliloquy or MetaSlider.
- Page Builder – Oxygen, Gutenberg, Genesis – most builders are slow.
- Gallery – Gutenberg Gallery or Meow Gallery.
- Analytics – Google Analytics and Google Search Console (no plugins).
- Social Sharing – Grow By Mediavine (fastest social sharing plugin in WP Rocket’s test).
- Comments – native comments or wpDiscuz with optimized settings with JavaScript delay.
6. Disable WordPress Heartbeat
WordPress Heartbeat consumes resources by showing real-time plugin notifications, when other users are editing a post, etc. For most website owners, it usually does more harm than good. There are many plugins to disable this (WP Rocket, Perfmatters, most cache plugins).
To disable the WordPress Heartbeat API without a plugin, go to Appearance > Theme Editor, then edit the functions.php file of your theme. Next, paste the code right after the <?php tag:
add_action( 'init', 'stop_heartbeat', 1 );
function stop_heartbeat() {
wp_deregister_script('heartbeat');
}
7. Don’t Combine CSS + JavaScript Files
While speed tests reward you for combining CSS and JavaScript files, it could actually be hurting your load times.
WP Johnny posted an interesting article on why you shouldn’t combine. There have also been a few reports of improved TTFBs in Facebook Groups after unchecking these options. While the topic is debatable, it’s worth a try. Remember, scores don’t matter nearly as much as load time.
8. Avoid Page Builders
Websites using page builders got crushed after the big GTmetrix update.
On top of the extra CSS, JavaScript, and countless div wrappers, these websites typically rely on extra third-party plugins/addons. The result is a lot of bloat, slower website, and a slower TTFB.
I recommend Oxygen, Gutenberg, GeneratePress, Astra, OceanWP, or Neve are some good choices. And yes, I made the mistake of using Elementor but am replacing it with Gutenberg.
9. Cache Everything In Cloudflare
If you’re using Cloudflare, add a page rule to cache everything.
Go into your Cloudflare dashboard > Page Rules. Copy and paste the rule below, only replace my domain with yours. If you have WooCommerce or a dynamic site and run into issues when adding the cache everything page rule, try using the WP Cloudflare Super Page Cache plugin.
10. Reconfigure Your CDN
CDNs are great for reducing TTFBs (theoretically).
By offloading bandwidth to their data centers, you’re lightening the load on your server which should improve it’s TTFB. This sounds great, but CDNs can actually cause TTFBs to be slower.
Slower TTFBs on Cloudflare have been reported numerous times in Facebook Groups. After chatting with WP Johnny (he’s a master of speed optimization), he also reported that WP Rocket’s RocketCDN (which uses StackPath’s data centers) can also result in slower TTFBs.
Since then, I made the switch to BunnyCDN. It’s highly recommended in Facebook Groups, affordable, and easy to setup using their setup instructions. It’s also consistently performant.
A few things to consider:
- If your visitors are local, don’t use a CDN.
- If using Cloudflare, consider testing out their APO.
- If your TTFB is slow, try disabling your CDN and retest.
- Cloudflare and RocketCDN (StackPath) can sometimes have a negative affect.
11. Clean Up Your Database
A thorough database cleanup can help reduce TTFBs in WordPress.
And yes, your cache plugin probably already has a database cleanup option.
But on top of that, I would install WP-Optimize and do a thorough cleaning of your database. WP-Optimize lets you go through your actual plugin tables and delete tables left behind by old plugins you previously deleted (shown as “Not Installed”). Backup your site before doing this.
12. Delete Unused Themes + Plugins
Head to Appearance → Themes and delete any themes you’re not using. You can keep one version (eg. Twenty Seventeen theme) in case something goes wrong with your active theme.
13. Configure A Solid Cache Plugin
WP Rocket and LiteSpeed Cache are the gold standards for cache plugins.
However, most people don’t configure these with the optimal settings. I have written popular tutorials on configuring WP Rocket, WP Fastest Cache, W3 Total Cache, and WP Super Cache.
With most other cache plugins, you would need to install about 6 extra plugins to get these features, when WP Rocket has them all built-in, reducing the number of plugins on your site. If you’re like me, you only want to use 1 plugin, otherwise you will need to research which features your cache plugin comes with, then install these plugins if it doesn’t support them.
- Database cleanup – WP-Optimize
- CSS/JS optimization – Autoptimize
- Delay JavaScript execution – Flying Scripts
- Host Google Analytics locally – Flying Analytics
- CDN URL integration – BunnyCDN / CDN Enabler
- Heartbeat control – Heartbeat Control / manual code
- Lazy load images/videos – Optimole / WP YouTube Lyte
- Preload links / instant page – Perfmatters or Flying Pages
- Host Facebook Pixel locally – no plugin does this that I know
- Prefetch/preload – Pre* Party Resource Hints / manual code
- Font-display:swap – Swap Google Fonts Display / manual code
Get 10% off WP Rocket by signing up for their email list on their coupons page. Then check my recommended WP Rocket settings for optimal GTmetrix scores/load times.
14. Block Unwanted Bots
Have you checked your Wordfence live traffic report lately?
I did, and I saw the same few bots were hitting my site constantly and putting stress on my server. Obviously Googlebot and other ones are good, there may also be spam bots hitting your site. Unless you check, you’ll never know. Here’s what I did, and what you should do too:
Step 1: Install Wordfence.
Step 2: View the live traffic report for a few minutes to see who is hitting your site in real-time.
Step 3: Take note of sketchy-looking bots constantly hitting your site. Google their hostnames to see if other people are reporting them as spam (Googlebot and Bingbot are obviously okay).
Step 4: Block all spam bots (you have a few options here). Wordfence has blocking settings as well as rate limiting rules. However, Wordfence consumes a lot of CPU itself. The alternatives are Blackhole For Bad Bots, Block Bad Queries, or Cloudflare Firewall Rules (this is what I use). You can create up to 5 free firewall rules which means you can block your top 5 spam bots. Just copy their hostname from Wordfence, then block it in Cloudflare. Be sure to use an asterisk* so any variations of that bot are also blocked: amazonaws.com linode.com are 2 common ones.
15. Update To PHP 7.4
Many WordPress sites still run PHP 5 even though PHP 7.4 is much faster. That’s because hosting companies won’t automatically upgrade your PHP version (due to potential compatibility issues) which you can use the PHP Compatibility Checker plugin to check for.
Upgrade to PHP 7.4 in your hosting account, then check your site for errors:
Make sure your MySQL or MariaDB is also updated to the latest version.
16. Increase Memory Limit To 256MB
Elementor and WooCommerce both require a 256MB memory limit, but you should really increase it to 256MB anyway especially if your website is getting fatal memory limit errors.
Add the code to your wp-config.php before “Happy Blogging.”
define('WP_MEMORY_LIMIT', '256M');
Some shared hosts allow this while other shared hosts require you to contact them. Cloud hosting providers almost always allow this (below is for Cloudways).
17. Update WordPress Core, Theme, Plugins
Keep WordPress core, themes, and plugins updated.
18. Use A Premium DNS
DNS can also impact your server response times.
GoDaddy, Namecheap, and other budget providers offer a DNS, but these low quality providers can cause high DNS lookup times. Many managed hosts offer a premium DNS, otherwise consider moving your DNS to a faster provider (either your host or Cloudflare if you’re using it).
19. Optimize Third-Party Code
If you’re using third party scripts, these cause extra requests and will show up in your GTmetrix report. Some scripts are difficult or even impossible to optimize (especially Google AdSense and social widgets which are best to avoid all together), but I listed quite a few optimizations below.
Tips For Optimizing Third-Party Code
- Disques + Gravatars – use conditional load or Flying Scripts.
- Contact Form 7 Asynchronous Loading – load it asynchronously.
- Google AdSense – use Ad Balancer and Rocket Loader.
- Google Analytics – host it locally using WP Rocket or CAOS Analytics.
- Google Maps – only use them on pages where you need them (eg. contact form)
- Google Fonts – combine Google Fonts in WP Rocket, Autoptimize, or try Self-Hosted Google Fonts/OMGF. Or, host fonts locally by downloading them directly from Google Fonts, converting them to web font files in Transfonter, and adding them to your CSS.
- Async JavaScript – try Async JavaScript to load other scripts asynchronously.
- Embedded YouTube Videos – lazy load videos and replace the iframes with preview images using WP Rocket (in the media section), or use the WP YouTube Lyte plugin.
- Prefetching – this helps browsers anticipate external resources. Copy these common domains to prefetch then paste them into WP Rocket, Perfmatters, or do it manually.
- Selectively load plugins using external scripts – use Asset Cleanup or Perfmatters to disable plugins (especially those with external scripts) from loading on certain content.
Frequently Asked Questions
What causes a slow server response time?
Servers are controlled by your hosting. If you're using a low quality host or are putting too much stress on your server (e.g. with high CPU plugins), this can cause slow response times.
Which hosting has slow TTFBs?
GoDaddy, Bluehost, HostGator, SiteGround, and EIG brands are infamous for having slow servers. Migrating to a faster host is the easiest way to remedy a slow TTFB.
What is a good server response time?
Google recommends a server response time of <200ms. However, this is usually only possible if you are knowledgeable about website optimization and are using fast hosting.
What affects server response times?
Hosting, themes, plugins, page builders, CDNs, and many other optimizations can affect server response times.
How do you measure server response times?
Server response times can be measured in Lighthouse, GTmetrix, Pingdom, Chrome DevTools, and KeyCDN.
Conclusion: join the WordPress Hosting Facebook Group to get real, unbiased opinions. Look at the Facebook polls that were taken and people who migrated to different hosts and posted their results. Finally, stay clear of low quality hosting affiliates who only want the commissions.
Cheers,
Tom