How To Reduce CPU Usage In WordPress (And Avoid Getting Bandwidth Limit + CPU Errors Where Your Site Gets Shut Down)

CPU overages are a classic sign your server is being overloaded.

You can reduce CPU usage by removing heavy plugins, heavy page builders, database junk, disabling WordPress heartbeat, blocking bad bots, and using a good cache plugin with a CDN.

The other (and more likely) reason for high CPU is that you’re using shared hosting which is infamous for having strict CPU limits (just check your host’s terms and conditions page). If you exceed them, you will likely run into 503 errors or your website will become extremely slow. GoDaddy, Bluehost, HostGator, and SiteGround all have limits. “Unlimited bandwidth” is a lie.

I’m guessing 90% of people reading this article are on shared hosting when you can easily fix this by moving to someone like Cloudways. Sign up for a $10/month DigitalOcean plan, request a free migration, and retest your CPU usage, server response times, and GTmetrix load times. This has already been done by people who posted their migration results. They’re also the most recommended host in Facebook Groups with numerous #1 ratings in hosting polls on Facebook.

Regardless, this tutorial will help you reduce your WordPress site’s CPU usage. Follow along :)

Reduce-CPU-Usage-WordPress

 

1. Check Your Website’s CPU Usage

Most hosting dashboards have an option to check CPU usage.

It should never be close to 100% (you want the server to be relaxed). Many hosts also have AWStats which identifies how much CPU certain bots, images, and files are consuming. If you notice something specific is consuming lots of CPU, address it. For example, bad bots can be blocked using the Blackhole For Bad Bots plugin, and images can be optimized to load faster.

Reduce-CPU-Usage-WordPress

Check Your Server Response Time – it’s also a good idea to run your site through Google PageSpeed Insights to check your server response time which Google says should be >200ms.

Reduce Server Response Time

 

2. Ditch Shared Hosting

Shared hosting may not have enough server resources especially if you’re running high CPU plugins, page builders, Google AdSense, or get a decent amount of traffic. And it’s especially not a good idea to run WooCommerce or WPML on shared hosting since they are resource-hungry.

Hosting recommendations are usually garbage.

Join the WordPress Hosting Facebook Group to get unbiased feedback. Most members (myself too) swear by Cloudways WordPress Hosting. Specifically DigitalOcean / Vultr High Frequency.

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

Here’s what happened when I moved:

SiteGround vs Cloudways

GTmetrix tests are always different, but even posts with a huge page 2.70MB page size and 96 requests can often load in under 2s. I’ll also take a 148ms time to first byte any day of the week. That post has 70+ images, 480 comments (showing Gravatars), Font Awesome, and Elementor.

OMM-TTFB

The evidence is there:

Cloudways Response TimesCloudways-Migration-Result
Cloudways Google PageSpeed
WP Engine To Cloudways
DigitalOcean Pingdom Report
Hosting-Recommendation
Moving-From-WPX
SiteGround-Alternatives
Preferred-Web-Hosting
UntitledWPEngine-To-Cloudways
Godaddy DigitalOcean Migration
Cloudways Pingdom Load Times
Cloudways Pingdom Report
Elementor-Hosting
Web-Hosting-France
SiteGround-Alternative
VPS-Cloud-Hosting

 
This was a simple Pingdom test to measure load times of 16 WordPress hosts. I signed up for popular hosting companies then installed the same Astra Starter Site on each of them while measuring load times in Pingdom for 1 week at 30 minute check intervals. Some domains are still live (cwdoserver.com is hosted on a $10/month Cloudways DO plan and stgrndserver.com is hosted on SiteGround GrowBig). I cancelled most of them because it was getting expensive. Even when browsing through their pages or running your own tests, you can see the difference.

WordPress-Hosting-2020-Pingdom-Test

Hosting Companies You Should Avoid

  • SiteGround – they have gone completely downhill in recent years.
  • Bluehost – slow servers, owned by EIG, bad support, rated poorly in FB Groups.
  • HostGator – also owned by EIG with slow servers, bad support, CPU limit issues.
  • GoDaddy – top malware hosting network worldwide, rated poorly in FB groups.
  • Hostinger – they write fake reviews and vote for themselves in Facebook polls.
  • WP Engine – also not what it used to be, expensive and not even fast anymore.
  • *A2 Hosting – if you can’t afford Cloudways, A2 is still fast and uses LiteSpeed.

I use Cloudways because:

  • Even posts with a 2.70MB page size can load in under 2s
  • DigitalOcean and Vultr HF are miles faster than shared hosting.
  • It’s $10-$13/month (no yearly contracts or high renewal prices).
  • Varnish, Redis, and memcached are all built-in for higher performance.
  • You get to pick from DigitalOcean, Vultr HF, Linode, AWS, Google Cloud.
  • 4.8/5 star TrustPilot rating and highly recommended in Facebook Groups.
  • They have 25+ data centers between all their cloud hosting providers.
  • No CPU issues like on SiteGround, Bluehost, and other shared hosting.
  • SSL, staging, and backups are all very easy in the Cloudways dashboard.
  • Support used to be average, but is now really good as reflected on TrustPilot.
  • They offer a free migration but their Migrator plugin will also do the trick.
  • Adding a server, migrating your site, and the dashboard is actually very easy.
  • Mustasaam (their community manager) gave me peace of mind when moving.
  • Only complaint is they need to add LiteSpeed servers to their list of providers.

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.

Just do your research and look at this Facebook thread.

 

3. Eliminate High CPU Plugins

These resource-hungry plugins are CPU killers.

High CPU plugins usually include social share, statistic, chat, calendar, page builders, backup, and plugins that run ongoing scans/processes or show multiple times in your GTmetrix report.

  1. AddThis
  2. AdSense Click Fraud Monitoring
  3. All-In-One Event Calendar
  4. Backup Buddy
  5. Beaver Builder
  6. Better WordPress Google XML Sitemaps
  7. Broken Link Checker
  8. Constant Contact for WordPress
  9. Contact Form 7
  10. Contextual Related Posts
  11. Digi Auto Links
  12. Disqus Comment System
  13. Divi Builder
  14. Elementor
  15. View Full List Of 65 Slow Plugins

Find Slow Loading Plugins
If the same plugin shows up multiple times in your GTmetrix report, or it takes a long time to load in your Waterfall tab, you may want to find an alternative plugin that is more lightweight.

Slow WordPress Plugin

Query Monitor
Query Monitor shows your slowest plugins, scripts, styles, queries, PHP errors, and information to pinpoint CPU issues. Delete the plugin when you’re done since it can cause high CPU in itself.

Queries-By-Component

 

4. Rethink Your Page Builder

Oxygen is the fastest, otherwise your page builder could be causing high CPU.

Even Elementor adds a ton of scripts to your website (which you can see in Asset CleanUp or Perfmatters) and makes the front end and admin panel run slower, requiring more resources.

Elementor Scripts 1

 

5. Clean Your Database

Most people are using WP Rocket (if you’re not, you should) which has an option to clean your database. Otherwise, use a plugin like WP-Optimize. Keep your database clean by running a scheduled cleanup once every 1-2 weeks. People who edit their content a lot will accumulate thousands of post revisions which can be deleted if you don’t need old versions of the content.

WP-Rocket-Database-Settings

One thing I like about WP-Optimize is that it lets you go through your actual database tables and delete tables left behind by old plugins. This happens when you install and plugin then delete it. If you don’t plan on using the plugin again, delete the table (shown as Not Installed).

WP-Optimize-Tables

 

6. Upgrade To PHP 7.4

Login to your hosting account and find the area to update PHP versions.

Upgrade to the highest possible version and check your website for errors (if you see any, revert to an earlier version). Some hosts are slower to release PHP versions than others, but hosts like Cloudways and SiteGround are usually very quick. As you see below, my site is running PHP 7.4.

PHP-7.4

 

7. Offload Resources To CDNs

CDNs reduce bandwidth by offloading resources to data centers. Cloudflare or WP Rocket’s RocketCDN will greatly reduce server loads. Caching 58.88GB of bandwidth in 1 month is huge.

Cloudflare and RocketCDN are both very good (I personally use RocketCDN which uses StackPath’s data centers) but you should only use one. Some hosts have an option to activate Cloudflare in your hosting account (eg. SiteGround), otherwise you will need to sign up for Cloudflare and change nameservers. RocketCDN can be set up in WP Rocket’s CDN settings.

Cloudflare-Bandwidth-Savings

 

8. Disable WordPress Heartbeat

The WordPress Heartbeat API shows real-time plugin notifications, when other users are editing a post, etc. Since it consumes resources, it should be disabled or limited. Do this by adding the code below to your functions.php file, use WP Rocket, or Heartbeat Control plugin.

Disable Heartbeat

add_action( 'init', 'stop_heartbeat', 1 );
function stop_heartbeat() {
wp_deregister_script('heartbeat');
}

 

9. Disable Usage Tracking From Plugins

Plugins like to get stats from you, but this also consumes a small amount of CPU.

Usage-Tracking

 

10. Disable Unused Plugin Functionality

If you have a robust plugin installed but you only use a few of it’s features, disable the ones you don’t use. Some common examples are Elementor plugins, JetPack, and unused Yoast features. This is especially true for plugins that run ongoing processes (eg. Broken Link Checker, Query Monitor, stats plugin, or even plugins that send you notifications in the WP admin or via email).

Disable-Addons

 

11. Disable SiteGround’s SG Site Scanner

If you’re getting CPU overages on SiteGround and you paid for their SG Site Scanner, try contacting their support team to turn this off. The ongoing scans may be causing high CPU.

SiteGround-SG-Site-Scanner

 

12. Disable Resource-Hungry WooCommerce Features

WooCommerce sites naturally require more CPU. This is something to keep in mind when choosing hosting, and I highly advise not use WooCommerce on shared hosting.

Optimizing Woocommerce

  • Disable WooCommerce cart fragments
  • Disable WooCommerce scripts and styles
  • Disable WooCommerce widgets
  • Disable WooCommerce status metabox
  • Disable automatic product feed plugins

Most of these can be done using the Perfmatters plugin, otherwise search on GitHub.

perfmatters woocommerce optimization

You will also want to clear customer sessions in your Status settings

 

13. Check For Errors With Your Cache Plugin

A few things related to cache plugins can affect CPU:

  • Whether you’re using a cache plugin
  • Which cache plugin you’re using
  • Whether the settings are configured optimally
  • Whether your cache plugin is giving you CPU issues

To answer the first three, I recommend WP Rocket since it has more speed optimization features than any other cache plugin (that’s why it’s #1 in Facebook polls and yields great results). See my recommended WP Rocket settings. And to answer the fourth, see below.

Common Fixes In WP Rocket

WP Rocket says:

Occasionally some of the options on the File Optimization tab, such as Remove Query Strings, or Minify/Combine can cause high CPU usage in cases where your site has a lot of CSS or JS files. Try disabling these options and then monitor your CPU usage.

There have also been reports that critical path CSS and preloading can increase CPU. You can use a plugin to increase the preload crawl interval from 500ms (the default) to 1.5s or higher.

Common Fixes In W3 Total Cache

  • Test object cache + database cache
  • Delete and reinstall the plugin

Why WP Rocket?
It has more features than most cache plugins, which means you don’t need to install extra plugins for these, while giving you better results. Otherwise you will need to research which features your cache plugins comes with, then install these plugins if it doesn’t support them:

Some hosts like GoDaddy and WP Engine blacklist cache plugins because they have their own built-in caching system. In this case, use Autoptimize to optimize HTML, CSS, JavaScript (it also has a CDN option). See my recommended Autoptimize settings.

You can also try disabling your cache plugin and checking CPU usage. If your cache plugin is indeed causing issues, reach out to the plugin developer (or switch plugins).

2016 best cache plugin poll

2019 cache plugin poll

Swift vs WP Rocket

2016 cache plugin poll

Best cache plugins 2018 poll

wp rocket vs w3 totla cache

 

14. Reduce Bloat

By “bloat” I’m referring to WordPress heartbeat, autosaves, post revisions, pingbacks, and all the “miscellaneous” things that consume CPU and should generally be disabled. Unfortunately, many of these are built-in to WordPress. Perfmatters and Clearfy are both good options. I like Perfmatters because it’s strictly a bloat removal plugin and comes with a script manager for selectively disabling plugins, while Clearfy tries to do SEO + security (and no script manager).

perfmatters settings

 

15. Block Bad Bots

You would never know if bad bots are hitting your server without checking.

Download Wordfence and view your live traffic report to see which bots are hitting your server in real-time. Obviously there are some good bots (eg. Googlebot) but if you see suspicious bots constantly hitting your server, Google their “hostnames” to see if other people are reporting them as bad. If they’re bad, blocking them can prevent them from consuming server resources.

Live-Traffic-Report-Wordfence

Methods For Blocking Bad Bots

Cloudflare Firewall Rule To Block Bad Bots

Monitor the log to make sure it’s working (screenshot is for Cloudflare):

Cloudflare-Firewall-Events

 

16. Optimize Images

Images can consume lots of bandwidth, as shown in AWStats:

File-Type-Bandwidth

There are 3 main ways to optimize images in GTmetrix.

Image-Optimization

  • Serve scaled images – resize large images to be smaller
  • Specify image dimensions – specify a width/height in the HTML (see screenshot)
  • Optimize images – losslessly compress images (I recommend TinyPNG)

Start by optimizing images that appear on multiple pages (logo, sidebar, footer images). Then run your most important pages through GTmetrix and optimize individual images on those. The first item you should work on is “serve scaled images” since this requires you to scale (resize) an image to the correct dimensions, upload the new image version to WordPress, and replace it.

Hotlink protection can be enabled in Cloudflare (or sometimes your hosting account). This prevents people from copying/pasting your images onto their own website, which sucks up bandwidth. This usually happens if you have high quality images on your site (eg. photography).

Cloudflare Hotlink Protection

 

17. Reduce WP-Cron Jobs

The wp-cron is loaded on every page load and schedules automated tasks like publishing scheduled posts, checking for theme and plugin updates, and sending email notifications. Instead of running it on every page load, you can schedule it to run every 90 minutes or so.

Step 1: Disable WP Cron Jobs

Add the code to wp-config.php, before where it says “That’s all, step editing! Happy blogging.”

define('DISABLE_WP_CRON', true);

Step 2: Replace With A Real Cron Job
You still need wp-cron (eg. checking for theme/plugin updates), just not on every page load. Each host has their own instructions for this, here is SiteGround’s tutorial. You can set the cron job to run every 90 minutes, or increase it even more if you don’t have lots of scheduled tasks.

 

18. Block Comment Spam

An ongoing accumulation of spam comments isn’t good for your CPU usage. The Anti-Spam plugin has always worked well for me (I tested plenty of others) and it doesn’t use CAPTCHA.

 

19. Protect Your WP-Admin

Attacks are commonly targeted at the WP admin which consumes high amounts of CPU.

The easiest way to fix this is to move your wp-login page (since bots usually just target the default login page). You can do this with Perfmatters or Move Login. You can also try limiting login attempts and if using Cloudflare, create a page rule to bypass the cache inside the admin.

WordPress-Admin-Page-Rule

 

20. Minimize Third Party Requests

Run your site through PageSpeed Insights to see which third party scripts load on your site.

Third-Party-Usage

Google AdSense and Tag Manager usually consume high CPU since they’re heavy (and little optimization can be done to them). But other third party scripts can definitely be optimized: my WordPress speed guide shows you how to optimize Google Fonts, Analytics, Gravatars, embedded YouTube videos, and others. Many of these can be optimized using WP Rocket and Flying Scripts (it’s how I’m able to use wpDiscuz + Gravatars without them affecting GTmetrix).

Prefetching third party scripts (eg. in WP Rocket) will also help:

Prefetch-DNS-Requests

 

21. Avoid Resource-Hungry Themes

I highly recommend Oxygen or StudioPress.

They’re much more lightweight than Elementor which is what most people use Astra themes with. While Astra + Elementor may be the most popular, it’s definitely now the fastest. View my source code to see how many times Elementor shows up; my next redesign will be on Oxygen.

Astra-Themes-Facebook-Poll

 

22. Delete Unused Plugins + Themes

Unused themes store preconfigured settings in your WordPress database (similar to plugins). Go to Appearance > Themes then delete all the WordPress themes you’re not currently using.

Delete-Unused-WordPress-Themes

 

23. Host Download Files On Dropbox

I barely have any files to download on my website so the bandwidth is low enough where I don’t worry about this. But if you have tons of large files that suck up bandwidth when people download them, consider uploading them to Dropbox or another file sharing website and pointing people there. That way dropbox.com will be handling the bandwidth and not you.

Download-Bandwidth

 

Frequently Asked Questions

✅ What is the easiest way to reduce CPU in WordPress?

Find and eliminate high CPU plugins, update to PHP 7.4, configure a good cache plugin with optimal settings, using a CDN, and disable unneeded WordPress functions like the Heartbeat API. Upgrading to faster hosting will obviously help.

✅ Which plugins consume the most CPU?

Social sharing, statistic (analytic) plugins, sliders, portfolios, page builders, calendars, chat, contact forms, related post, sitemap, Wordfence, WPML, and any plugin that runs ongoing scans or processes. These can be found using Query Monitor or GTmetrix Waterfall.

✅ Does all shared hosting have CPU limits?

Yes. Even though some shared hosting companies claim to have unlimited bandwidth, they still enforce CPU limits. This is usually found in their terms are conditions.

✅ Does WooCommerce cause high CPU?

WooCommerce sites generally require more plugins, and often times, more CPU. If these are not selected carefully, the extra resources consumed by those plugins can put stress on your server. WooCommerce sites also load extra scripts, styles, and cart fragments which don't help either. WooCommerce sites are better off on cloud hosting.

✅ How can I check my website's CPU consumption?

Your hosting account should tell you how much CPU you're consuming. Some hosts have tools like AWStats which show specific images, bots, and other resources that consume lots of resources.

Let me know if this tutorial worked in the comments!

See Also: WordPress Speed Guide

Cheers,
Tom

Subscribe
Notify of
guest
59 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments