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 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 CPU usage in WordPress.

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

Most hosting recommendations are garbage and I suggest joining the WordPress Hosting and WP Speed Matters group to get unbiased feedback because let’s be honest, we’re all affiliates.

  • SiteGround has a slow TTFB, CPU limits, support went downhill, among other issues. Unethical considering their community manager (Hristo) is an admin for this Facebook Group, and the TOS (sec. #9) prevents affiliates from using ‘SiteGround’ in bad reviews.
  • Hostinger writes fake reviews, votes for themselves in polls, also unethical.
  • GoDaddy is like my ex-girlfriend: lots of promises, but absolutely no delivery.
  • WP Engine used to be good, but most people left them and speed/support are awful.
  • EIG brands (Bluehost + HostGator) cram too many websites on slow, shared servers.

Regardless if you use my aff links, please don’t support unethical companies.

I use Cloudways (Vultr HF) who has always given me a fast TTFB and great GTmetrix results even on huge posts. You can click through my posts (most of them are very long) and they will load instantly. LiteSpeed is also popular which you can get through NameHero or A2 Hosting. I like NameHero’s Turbo Cloud plan which includes more RAM, NVME storage, and is still cheap.

Both are completely different setups. On Cloudways, I use WP Rocket with BunnyCDN. On a LiteSpeed hosting plan, you would be using the LiteSpeed Cache plugin with QUIC.cloud CDN. They’re both great setups and should give you a fast TTFB / server response time in GTmetrix, especially if you use my WP Rocket or LiteSpeed Cache tutorial to configure the ideal settings.

You can read my Cloudways review or NameHero review. NameHero is easier (cPanel, A+ support, email hosting) while Cloudways is a little “techier” but gives you better control of your server and has way more data centers in the US, India, UK, etc. Cloudways is monthly pricing with a free migration while NameHero has a 30-day refund policy and also has a free migration.

I switched from SiteGround to Cloudways in 2019. My response times were 2x faster, I was paying 1/2 the price of what I was on SiteGround, and had no CPU issues or high renewal prices.

Cloudways Shoutout

When in doubt, check Facebook polls:

Moving from SiteGround
eCommerce Hosting Poll

People who moved to Cloudways and posted results:

Cloudways Numbers
Cloudways-BuddyBoss

Hosting recommendations - Facebook thread

Cloudways Coupon Code
OMM25 gives 25% off your first 2 months at Cloudways
 

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 73 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 Waterfall

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 8.0

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 8.0.

PHP 8.0

 

7. Offload Resources To CDNs

CDNs reduce bandwidth by offloading resources to data centers.

Popular CDN Choices

  • Cloudflare – free and sufficiently for smaller sites but can sometimes negatively affect load times, TTFB, and PageSpeed scores. For optimal results, add a cache everything page rule and consider using the automatic platform optimization to cache dynamic content.
  • BunnyCDN – highly recommended in Facebook threads (this one too) and is the CDN I recommend. Affordable pricing, consistently performant, and easy to setup using their setup instructions or with the BunnyCDN plugin. BunnyCDN is what I use on my website.
  • RocketCDN – WP Rocket’s CDN which uses StackPath’s data centers but isn’t the best choice if you’re going to pay for a CDN. Can actually increase TTFBs in some cases (this has been reported in Facebook Groups). RocketCDN just isn’t as performant as Bunny.

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. The Disable WooCommerce Bloat plugin can help you remove more bloat inside the admin panel.

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).

WP Rocket was #1 in most Facebook polls (click thumbnails to enlarge):

 

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). Make sure you disable XML-RPC if you don’t use your mobile devices to post to WordPress.

perfmatters settings

 

15. Add A Firewall

A firewall can also reduce CPU by preventing attacks and obviously improves security. Cloudflare’s Firewall starts at $20/month, otherwise you can also try Sucuri or Wordfence.

Cloudflare Web Application Firewall

 

16. Increase Connection Limits

Most cloud hosting providers let you increase connection limits in your dashboard (below is for Cloudways). For most shared hosts including SiteGround, you’ll need to request this from them.

Max Connections Limits

 

17. 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

 

18. Replace 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.

 

19. Optimize Images

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

File-Type-Bandwidth

There are quite a few ways to optimize images.

GTmetrix Image Optimizations

  • Defer offscreen images – lazy load them.
  • Properly size images – resize large images to be smaller.
  • Specify image dimensions – specify a width/height in the HTML (screenshot).
  • Efficiently encode images – losslessly compress images (I recommend TinyPNG).
  • Next-gen formats – use a WebP plugin to convert JPEG/PNGs to faster WebP format.

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

 

20. 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.

 

21. 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

 

22. 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

 

23. Avoid Resource-Hungry Themes

I generally recommend Oxygen, Astra Starter Templates with Gutenberg, or GeneratePress. They’re much more lightweight than Elementor or Divi. If using Elementor, try to use the Hello Theme and remove unused Elementor CSS and JavaScript using Perfmatters or Asset CleanUp.

Fastest WordPress Themes

 

24. 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

 

25. 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

 

Other Solutions

Ivica also has a list of possible solutions to reduce CPU:

SiteGround CPU Limits Solutions

 

Frequently Asked Questions

How do I reduce CPU in WordPress?

Find and eliminate high CPU plugins, use the latest PHP version, configure a good cache plugin with optimal settings, use a CDN, and disable unused features 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 New Relic.

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 on their terms are conditions page.

Does WooCommerce cause high CPU?

WooCommerce sites generally require more plugins, and often, more CPU. If these are not selected carefully, these extra resources can stress your server. WooCommerce sites also load extra scripts, styles, and cart fragments. Generally, WooCommerce sites are better off on cloud hosting.

How do 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 resources that consume CPU.

See Also: My Ultimate WordPress Speed Guide

Let me know if you need help! Just drop me a comment and I’ll get back to you.

Cheers,
Tom

About Tom Dupuis

Tom Dupuis 2017Tom Dupuis writes WordPress speed and SEO tutorials out of his apartment in Denver, Colorado. In his spare time, he plays Rocket League and watches murder documentaries. Read his bio to learn 50 random and disturbing things about him.

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