How To Reduce CPU Usage In WordPress (Make Your Website Run More Efficiently)

Reduce cpu usage wordpress

Welcome to the ultimate guide on reducing CPU usage in WordPress.

High CPU usage is often caused by plugins that constantly collect data, preload/cache expiration settings in cache plugins, as well as bots, CDNs, plugins, and WordPress Heartbeat.

Shared hosting is known for CPU throttling (that’s why it’s so cheap). When your website uses too much CPU, it’s throttled so it doesn’t affect other websites sharing the server. This can lead to a slow website, admin, and even 5xx errors. Before you upgrade, talk to your host and ask if they can spare you some temporary resources while you use this tutorial to optimize your site.

I wrote this guide after getting frustrated with SiteGround’s CPU limits which is a common issue in Facebook Groups. I don’t want to spam you and say “switch hosts” but this was the only thing that fixed it (even after upgrading plans and spending several days optimizing my site). I moved to Cloudways Vultr HF then recently to Rocket.net, but there are plenty of hosts that can reduce CPU usage with Cloudflare Enterprise, more resources, and efficient servers such as LiteSpeed.

Of course I’m an affiliate and want to make money by telling you to switch hosts, but I honestly don’t care who you use. Just think twice before you upgrade plans especially if it’s SiteGround.

 

1. Remove High CPU Plugins

Plugins are infamous for creating background tasks.

Any plugin (or plugin module) that has to collect data will probably be your worst culprit. This can be Wordfence’s live traffic report, Rank Math’s 404 logs and Google Analytics integration, or even plugins like Broken Link Checker and Query Monitor which constantly scan your website.

Some people will tell you to deactivate and reactivate plugins 1 by 1 and make sure they’re lightweight. This is broad advice and can be impractical. You can still use some of these plugins as long as you disable or tweak their settings to use less resources by limiting background tasks. However, some plugins are infamous for increasing CPU usage and should be removed entirely.

Tools You’ll Need:

  • Query Monitor – find your slowest plugins. Once installed, view a page on your site, find the Query Monitor menu in your admin bar, and go to Queries → Queries by component.

Slow wordpress plugins query monitor

  • WP Hive – free Chrome Extension that lets you browse the WordPress plugin repository and see whether a plugin impacts memory usage (as well as PageSpeed Insights scores).

Wp hive high memory usage plugins

  • WP-Optimize – shows you which plugins (or plugin modules) add the most database overhead. You can also remove tables from old plugins as well as other database junk. This image below shows how using many Rank Math modules can add lots of overhead.

Rank math database bloat

See the full list of 75+ slow plugins.

Plugin Category Memory Impact PageSpeed Impact
Analytify Analytics X
Backup Buddy Backup X
iThemes Security Security X
Broken Link Checker SEO X
Jetpack Security X X
Query Monitor Analytics X
NextGEN Gallery Gallery X X
Site Kit by Google Analytics X
Wordfence Security X
wpDiscuz Comments X X
WPML Translate X X
Yoast SEO SEO X

 

2. Limit Heartbeat, Autosaves, Post Revisions

These are more background tasks and should be limited.

Heartbeat runs every 15-60 seconds, autosaves are created every 60 seconds while you’re editing, and post revisions are stored every time you update a post (which aren’t limited at all).

Perfmatters does all of these. You can also do it manually with code or many cache plugins let you limit Heartbeat (i.e. FlyingPress + LiteSpeed Cache) as well as the Heartbeat Control plugin.

Limit Heartbeat – creates requests to admin-ajax.php. I would disable it in the frontend and dashboard, then limit post editor to 120s since you probably want it there for autosaves, etc.

Heartbeat control plugin settings

Or paste the following code into your functions.php file after the <?php tag.

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

Increase autosave interval – WordPress stores an autosave every 60s which is a little much. You could increase this to 120s or even to 300s by adding the code to your wp-config.php file.

define('AUTOSAVE_INTERVAL', 300); // seconds

Limit post revisions – WordPress stores a post revision every time you edit a post and hit the publish button. This creates a lot of database bloat since they’re not limited by default. Since you still want a few backups of your old posts (just in case), you could limit post revisions to 10.

define( 'WP_POST_REVISIONS', 10 );

 

3. Limit Preloading In Cache Plugins

Preloading in cache plugins is another culprit. Some plugins let you change how preloading works while other plugins don’t (in that case, try disabling it completely).

You should only preload important sitemap URLs. Preloading your entire sitemap means tags and other non-critical pages are preloaded and consumes resources. Find your sitemap URL (i.e. https://example.com/sitemap_index.xml), copy the most important URLs (i.e. pages/posts), and add them manually. Disabling preload entirely is another option since it’s known for increasing CPU usage. The screenshot below is for WP Rocket but the LiteSpeed Cache Crawler and most other cache plugins have options to control how preloading works. Check their documentation.

Wp rocket sitemap preloading

You can also increase the preload crawl interval using WP Rocket’s helper plugin or again, check your plugin’s documentation. Increasing the default interval from 500ms to 3000ms (or more) prevents your cache plugin from preloading URLs faster than your server can handle.

They have another helper plugin to disable automatic cache clearing. Any time you do one of these things, the entire cache is deleted and rebuilt. A better alternative is to set up a cron job to control when the cache is cleared and which pages are cleared (you can also do this with preloading). This way, you’re not constantly clearing the full cache when updating your website.

Finally, try disabling the “preload links” setting. If users constantly hover over internal links (especially on websites with lots of image links like WooCommerce products), this means those pages are constantly downloading in the background. Similar thing if you’re using Flying Pages.

Other Cache Plugin Settings That Impact CPU Usage:

  • Cache logged-in users (usually leave off)
  • Separate mobile cache (usually leave off)
  • Remove unused CSS (decrease the batch size)
  • LiteSpeed Cache guest mode, cache commenters, server stale

 

4. Use Cloudflare To Reduce CPU Usage

Cloudflare is your best friend for reducing CPU.

One thing that reduces CPU usage is improving cache hit ratio (with full page caching/APO) since uncached requests to your origin cause more stress than requests cached by Cloudflare.

  • CDN: offloads bandwidth to their 270+ data centers.
  • Bot fight mode: blocks bad bots from crawling your site.
  • Crawler hints: helps search engines avoid wasteful crawls.
  • Hotlink protection: stops websites from stealing image bandwidth.
  • Browser integrity check: extra layer to block bots/spammers/crawlers.
  • Argo: limits number of data centers that ask origin for content (paid service).
  • WAF: firewall improves security and reduces usage simultaneously (paid service).
  • Firewall rules – block bad bots, hackiest countries, specific URLs, XML-RPC, etc.
  • Rate limiting – identifies/mitigates excessive requests to specific URLs (paid service).
  • Full page caching: caches HTML to improve cache hit ratio and reduces origin requests.
  • Cloudflare Enterprise: Rocket.net has the best Cloudflare Enterprise (compared to Cloudways/Kinsta) mainly because it has full page caching, WAF, and built-in WAF rules to protect your site while only allowing about 10% of traffic to actually hit your origin server.
Cloudflare bandwidth
Cloudflare bandwidth savings (darker “cached bandwidth” is better)
Cloudflare proxy
Activate Cloudflare’s CDN by changing your website to “Proxied” in the DNS settings
Cloudflare hotlink protection firewall events
View what’s getting blocked in your firewall events

 

5. Protect Your WP-Login Page

Your login page is a common target for bots/attacks. Even if they don’t successfully login, attempting to create requests. Here’s how to protect the login page and stop these requests.

  • Limit login attempts: control how many times users attempt to login, lockout period, XMLRPC gateway protection, and other features using the Limit Login Attempts plugin.
  • Move the wp-login page: bots aren’t usually smart enough to find a custom login page which you can change using Perfmatters (if you’re already using it) or WPS Hide Login.
  • Use QUIC.cloud to protect the login: if you’re using QUIC.cloud with LiteSpeed, they have several security features to protect the login page, so I wouldn’t move it in this case.
  • SiteGround Security plugin: while I’m not a fan of SiteGround, their security plugin can move your login page, limit login attempts, disable XML-RPC, and help protect your site.

Perfmatters move wordpress login

 

6. Replace WP-Cron With A Real Cron Job

The wp-cron is loaded on every pageview and schedules automated tasks like publishing scheduled posts, checking for theme and plugin updates, sending email notifications, etc. Replacing this with a real cron job gives you better control and can help reduce CPU usage.

Before setting up an external cron job, the first step is disabling the built-in wp-cron. Add the code to your wp-config.php file before where it says “That’s all, step editing! Happy blogging.”

define('DISABLE_WP_CRON', true);

Now we’ll set up an external cron job. This can be different depending on your host (cpanel, VPS, etc). I suggest Googling instructions for them since SiteGround, Bluehost, Cloudways, and Hostinger all have their own guides. In cPanel, you would open the “cron jobs” tab and use the following line to set a cron job for every 10 minutes. You may think a higher interval would be better for CPU, but this can cause CPU spikes since too many jobs are running at the same time.

wget -q -O - https://yourwebsite.com/wp-cron.php?doing_wp_cron >/dev/null 2>&1

Cron job 10 minutes

External cron job

External cron job cpu spikes

WP Crontrol is nice for changing the schedule of specific cron jobs and deleting jobs with no action. You could also offload cron jobs from your server using a Cloudflare JavaScript worker.

 

7. Install Redis Or Memcached With OPcache

Both help reduce CPU usage, but your host must support them.

Opcache memcached redis

 

8. Use Cloud Hosting With No CPU Limits

Mainstream hosts (like SiteGround, Hostinger, GoDaddy, and WPX) don’t live up to the hype. They skimp out on CPU/RAM, use slower SATA SSDs, and are shared hosting with strict CPU limits which force you to upgrade. Cloud hosting is faster, but Kinsta and WP Engine still use SATA SSDs with low limits on PHP workers and monthly visits which get expensive. Instead of focusing on speed/technology, they do aggressive marketing… don’t fall for mainstream hosts.

For cloud hosting, I recommend Rocket.net (what I use) or Cloudways Vultr HF (what I previously used). Both use Cloudflare Enterprise which makes a major improvement to TTFB between full page caching, HTTP/3, image optimization, and Argo Smart Routing. Both also use NVMe, Redis, and have monthly pricing. However, Rocket.net is definitely faster since you get a lot more resources (32 CPU + 128GB RAM), LiteSpeed’s PHP (faster than Cloudways’ PHP-FPM), and Brotli. There are also no PHP worker limits due to Rocket.net’s free/automatic Cloudflare Enterprise which handles roughly 90% of traffic, resulting in less requests to your origin server. Finally, Rocket.net is easier between their dashboard and A+ support which is even better than Kinsta’s. Cloudways has more bandwidth/storage, but the technology isn’t as fast. One of these cloud hosts + Cloudflare Enterprise + FlyingPress (cache plugin) is the combination I would use.

WP Engine SiteGround Kinsta Cloudways Vultr High Frequency Rocket.net
Hosting type Cloud Cloud Cloud Cloud Private cloud
CPU cores Not listed 4 12 1 32
RAM (GB) Not listed 8 8 1 128
Storage type SATA SATA SATA NVMe NVMe
Storage (GB) 10 40 10 32 10
Object cache Redis Memcached Redis ($100/mo) Redis (Pro) Redis
Server Apache + Nginx Apache + Nginx Nginx Apache + Nginx Apache + Nginx
PHP processing Not listed FastCGI FastCGI PHP-FPM LiteSpeed
Bandwidth or monthly visits 25,000/mo 5TB 25,000/mo 1TB 50GB + 250,000/mo
CDN Cloudflare SiteGround CDN Cloudflare Enterprise Cloudflare Enterprise ($5/mo) Cloudflare Enterprise
CDN PoPs 270 14 270 270 270
Full page caching x Coming soon
Compression Brotli Brotli Brotli GZIP Brotli
HTTP/3
WAF
Argo smart routing x x x
Load balancing x x x
Image optimization x Limited x
CPU limits Low PHP workers Very common Low PHP workers Average None
Email hosting Limited x x x
TrustPilot rating 4.4/5 4.6/5 4.3/5 4.6/5 4.9/5
Monthly price $25 $100 $30 $13 + $5 for CF Enterprise $25
Plans Don’t use Don’t use Don’t use View plans View plans
Omm ttfb speedvitals 1
Sites hosted on Rocket.net average a 100ms global TTFB (search their TrustPilot reviews)
Keycdn global ttfb
You can also test TTFB in KeyCDN or click through my site to see how fast it loads

Rocket. Net trustpilot reviewKinsta to rocket. Net migrationMoved to rocket. Net vs sitegroundRocket. Net positive review

Rocket. Net vs cloudways vultr hf trustpilot reviewRocket. Net facebook review 1Rocket. Net vs kinstaKinsta to rocket. Net ttfb redis

Rocket. Net woocommerce elementor
Try Rocket.net for $1, request a free migration, then retest your TTFB (or reach out to Ben Gabler)

Why Rocket.net’s Cloudflare Enterprise Is Better

Rocket.net’s Cloudflare Enterprise is free, setup automatically, and uses full page caching (unlike Cloudways). And unlike Kinsta’s, Rocket.net has Argo Smart Routing (specifically good for WooCommerce sites), load balancing, and image optimization. Rocket.net CEO Ben Gabler also used to be StackPath’s Chief Product Officer and went as far as building Rocket.net’s data centers in the same locations as Cloudflare’s. And unlike both hosts, Rocket.net doesn’t limit PHP workers (there’s no CPU limits) and monthly visit limits are 10-25 times more than Kinsta’s.

Cloudflare Enterprise (Kinsta) Cloudflare Enterprise (Cloudways) Cloudflare Enterprise (Rocket.net)
CDN PoPs 270 270 270
Prioritized routing
Full page caching x
HTTP/3
WAF
Argo smart routing x
Load balancing x
Image optimization x
Automatic configuration x x
Price Free $5/mo (1 domain) Free

For shared hosting, I recommend NameHero. They use LiteSpeed servers which means you’ll use LiteSpeed Cache + QUIC.cloud CDN (arguably the fastest setup on a budget). It’s similar to Hostinger/A2 with LiteSpeed and cPanel, but you get more CPU/RAM and support/uptimes are better which is reflected in their TrustPilot reviews. I generally recommend their Turbo Cloud plan for $7.38/month which includes 3 CPU + 3 GB RAM and faster NVMe storage. The main con is their data centers are only in the US/Netherlands. If your visitors aren’t close to there, make sure to setup QUIC.cloud which has HTML caching (ideally the paid plan which uses all 73 PoPs).

SiteGround Hostinger GoDaddy WPX NameHero Turbo Cloud
Hosting type Shared Shared Shared Shared Shared
Storage SATA SATA SATA SATA NVMe
CPU cores Not listed 1-2 1-2 Not listed 3
RAM (GB) Not listed .768 – 3.072 .512 – 2 Not listed 3
Object cache Memcached x x x Redis
Server Apache + Nginx LiteSpeed Apache LiteSpeed LiteSpeed
CDN SiteGround CDN Cloudflare Enterprise QUIC.cloud QUIC.cloud Cloudflare Enterprise
CDN PoPs 14 73 14 73 73
Full page caching x
Compression Brotli Brotli Brotli GZIP Brotli
HTTP/3 x
WAF x
Image optimization Limited x x
CPU limits Common Low RAM Common At their discretion Average
Cache plugin SG Optimizer LiteSpeed Cache x LiteSpeed Cache or W3TC LiteSpeed Cache
Email hosting Limited Very limited Limited
Major incidents Google blocked DNS for 4 days Breach affecting 14M customers Breach almost every year Worldwide outage 2 day outage
Free migration $30/site Free Paid Free Free
Price $3-8/mo (1 year) then $15-40/mo $29/mo (yearly) $20.83 (yearly) $20.83 (yearly) $7.38/mo (1-3 years)
Renewals Very high Monthly Monthly Monthly Monthly
TrustPilot rating 4.6/5 4.4/5 4.9/5 4.5/5 4.9/5
Plans Don’t use Don’t use Don’t use Don’t use View plans
Litespeed vs nginx vs apache
LiteSpeed is faster than Nginx/Apache (and more efficient with less chance of CPU spikes)

Litespeed cache litespeed server

Cpu cores on litespeed hosting plans

Namehero vs siteground feedback

Ram on litespeed hosting plans

Problems with mainstream hosts

I’ve written some pretty bad reviews about SiteGround’s slow TTFB, CPU limits, and why SG Optimizer does a poor job with core web vitals (they also control several Facebook Groups and threaten to sue people who write bad reviews). Hostinger writes fake reviews and is only cheap because you get less resources like CPU/RAM. Kinsta and WP Engine are way too expensive for how many resources, PHP workers, and monthly visits you get. Along with major incidents like WPX’s worldwide outage and SiteGround’s DNS getting blocked by Google for 4 days (both WPX and SiteGround denied responsibility). One thing is clear: most mainstream hosts appear to be interested in profits/reputation over performance. Do your own research before getting advice.

12 things to know about hosting/TTFB

  1. Hosting is the #1 factor of site speed.
  2. TTFB is a key indicator of hosting performance.
  3. TTFB is part of core web vitals and is 40% of LCP.
  4. TTFB also affects INP (since latency is part of TTFB).
  5. SpeedVitals tests TTFB in 35 locations – use this tool!
  6. Test your site 3 times to get accurate numbers in SpeedVitals.
  7. Doing this ensures your caching and CDN are working properly.
  8. Check your average TTFB worldwide in your 3rd SpeedVitals test.
  9. Google flags your TTFB if it’s over 600ms, but under 200ms is better.
  10. PageSpeed Insights (and other testing tools) only test TTFB in 1 location.
  11. WP Hosting Benchmark also tests hosting performance (here are my results).
  12. Combining a good host/CDN is arguably the best way to improve TTFB (using a host with improved specs on top of Cloudflare Enterprise hits 2 birds with 1 stone).
Namehero cloudways rocket. Net
NameHero for shared, Cloudways Vultr HF for cloud, but Rocket.net outperforms both

 

9. Use PHP 8.0

Upgrade to PHP 8.0 in your hosting account (if you see errors, revert to PHP 7.4).

Php 8. 0

You should also consider increasing:

  • Memory limit (i.e. 512MB)
  • Max_execution_time
  • Max_input_time

 

10. Disable XML-RPC

If you don’t use mobile devices to publish content (or plugins like JetPack), you should disable XML-RPC not only for CPU reasons, but it also stops brute force + DDoS attacks. To disable it, paste the code in .htaccess and replace xxx.xxx.xxx.xxx with your IP address in case you need it. Alternatively, you can disable XML-RPC in Perfmatters or by using the Disable XML-RPC plugin.

# Block WordPress xmlrpc.php requests
<Files xmlrpc.php>
order deny,allow
deny from all
allow from xxx.xxx.xxx.xxx
</Files>

Disable xml rpc 1

11. Clean Up Your Admin Area

Other than making your admin look tidy, disabling things can save resources too.

Unbloater plugin

12. Stop Using Elementor/Divi

Elementor made improvements with Experiments and Divi released Performance settings.

However, most of these only affect the frontend while the editors still require a decent amount of server resources especially on shared hosting. I moved from Elementor to GeneratePress but Kadence and Oxygen Builder are good too. If you insist on keeping Elementor or Divi, hard code your header, footer, and sidebar in CSS which is more lightweight than heavy page builder code.

Elementor css
Use the coverage tab in Chrome Dev Tools to check “usage visualization”
Fastest wordpress themes
I tested several themes/builders and Elementor/Divi are the slowest by far

 

13. Disable Unused Hosting Add-Ons

Disabling unused features in your hosting account can also help.

This mainly applies to things like New Relic and xdebug. Just like many diagnostic tools, New Relic has to process a lot of data and should be disabled immediately after you’re done using it.

Cpanel php extensions

 

14. Keep Email/Web Hosting Separate

There’s a reason many cloud hosts don’t offer email hosting.

Emails take up indoes (files) and resources which could be better dedicated to hosting your website. Some shared hosts have very low inode limits and even say exceeding them can have an “adverse effect on server performance.” Use a third-party service like Google Workspace (what I use) or Cloudflare who started offering free email addresses. It’s a good idea to keep them separate anyway since in case you switch hosts, you don’t have to switch your email too.

Namehero inode limits
Email specifically takes up lots of inodes

 

15. Block Spam Comments

I recently switched to Antispam Bee (which doesn’t use CAPTCHA) ever since Akismet turned into a paid plugin. Otherwise my blog gets too much spam which isn’t good for CPU or my time.

Antispam bee plugin

 

16. Run A Malware Scan

Run a scan using Wordfence or another security plugin to check for malware and other vulnerabilities. Fixing other issues can improve security and may also help reduce CPU usage.

A lot of people have success using Wordfence to reduce CPU, but you’ll probably have to configure quite a few settings or the ongoing scans can actually make your problem worse.

Run wordfence scan

 

FAQs

How do I reduce CPU usage in WordPress?

The easiest way to reduce CPU usage is by limiting preloading in cache plugins, disabling high CPU plugins/modules, and using Cloudflare to offload bandwidth while using bot fight mode, crawler hints, and hotlink protection.

What happens if CPU usage is 100%?

If your CPU usage is 100%, ask your host to spare temporary resources so you have time to optimize your website. You may be able to lower usage so you don't have to upgrade plans.

How do I check CPU usage?

Your hosting dashboard should have tools to check CPU usage as well as memory, bandwidth, and disk space. Or use tools like AWStats, Query Monitor, and New Relic.

I know this can be a pain so feel free to drop a comment if you need help.

Cheers,
Tom

You Might Also Like:

79 Comments...

  1. Hi Tom,

    Thanks for the writeup, was and excellent read with loads of information.

    Appreciate you taking the time to share your knowledge.
    Have a good one. Cheers.

    Reply
    • Not using it myself but I know it comes highly recommended. Very good, lightweight. Lots of people use it like Adam from WPCrafter.

      Reply
  2. I’d steer away from Siteground. They notified us of going over the CPU limit today, and at the same time took our site down. So we’re scrambling to fix a complex issue while our business is being harmed. I feel like I’m being mugged at gunpoint right now.

    Reply
  3. Great tutorial. I took your recommendation and went to Siteground (through your affiliate link), and now I’m about to go to Cloudways (DigitalOcean) through your link. I was seeing 90+ on GTmetrix on my site hosted at Siteground, but since a few weeks, it has gone very low around 30-40. Don’t know what’s the problem.
    Switched Extra theme to GeneratePress, used Perfmatters, WpRocket and removed most unimportant plugins, but it only increased my scores to 54 Structure and 75 Performance. Can’t find a way to increase it… Maybe moving to Cloudways will help.
    And I noticed that GTmetrix’s interface changed recently… Have any details changed? What’s your thought on this?
    Thanks for reading my comment and for providing honest suggestions. You’ve been a big help!

    Reply
    • Hey Faiz,

      Thanks so much for using them, been hard to stay on top of the industry with so many changes going on. Yes, GTmetrix updated to include Lighthouse recommendations. Sites using page builders in particular seemed to have gotten punished because of extra CSS/JS. I’m in the process of removing my page builder, should have never used one. Many sites dropped in scores once GTmetrix released this update. Just remember to aim for fast load times instead of scores.

      Regardless, yes, SiteGround’s TTFB has gotten worse and worse. So many complaints about them in Facebook Groups. Cloudways or Gridpane are both good choices and you should see an improvement. If you were using SG Optimizer you will need to replace it (e.g. with WP Rocket).

      Hope that helps :)

      Reply
      • I recently installed WooCommerce so maybe that was the problem. Still, my other sites without WooCommerce were getting 77 in YSlow so I can say that SiteGround has gotten slow.
        I used your recommendation to get cloudways (through your link obviously) and migrated my site using their plugin. I had some issues with DNS, and their support helped very well. The wait time was extremely short. Then I installed SSL and was getting a B, so I contacted support and they helped me resolve it and now I’m getting an A.
        After doing all that, I am really surprised to see my GTmetrix scores. It’s an A with 98 performance and 87 structure. And I didn’t do anything except change hosting. Thanks a lot for your recommendation. Here’s a link if you want to check it out yourself. Link

        Reply
        • Wow, that’s pretty amazing. It’s good to see hosting is actually influencing the scores now instead of just load times. Excellent report!

          Reply
  4. 1) Do not use wordpress, especially for anything else than a basic blog. Their database design is flexible but terrible when it comes to scaling. I’ve reduced the size of the database by a factor of over 10 several times by migrating the sites to custom apps w/ proper database designs. I’m especially looking at you, people that want to start an ecommerce on wordpress…. Not a great idea, especially if you plan on actually growing past the small fish scale.

    Reply

Leave a Comment