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

Rocket.net with their free Cloudflare Enterprise will outperform any “mainstream host” since you get 32 CPU cores + 128GB RAM, NVMe storage, Redis, and Cloudflare’s full page caching + Argo Smart Routing. I use them and average a <150ms global TTFB (or click through my posts). They have no CPU limits since only about 10% of traffic hits your origin server on their hosting.

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

Omm t
tfb speedvitals 1

Mainstream hosts (like SiteGround, Hostinger, and WPX) don’t have a lot of CPU/RAM, use slower SATA SSDs, and are shared hosting with strict CPU limits which force you to upgrade plans. Cloud hosting is faster, but Kinsta still uses SATA SSDs with low CPU/RAM, PHP workers, and monthly visits (Redis also costs $100/month). Cloudways Vultr HF is who I previously used, but again, they start with only 1 CPU + 1GB RAM on slower Apache servers, PHP-FPM, and GZIP.

Here are Rocket.net’s:

All plans use 32 CPU cores + 128GB RAM with NVMe (faster than SATA), Redis (better than memcached), LiteSpeed’s PHP, and Brotli (smaller compression than GZIP). They have no PHP worker limits since only about 10% of traffic hits your origin due to their Cloudflare Enterprise.

SiteGround Hostinger Kinsta Cloudways Vultr HF Rocket.net
Hosting type Shared Shared Cloud Cloud Private cloud
Storage SATA SATA SATA NVMe NVMe
CPU cores Not listed 1-2 12 1 32
RAM (GB) Not listed .768 – 1.536 8 1 128
Object cache Memcached x Redis ($100/mo) Redis (Pro) Redis
Server Nginx LiteSpeed Nginx Apache Nginx
PHP processing FastCGI LiteSpeed FastCGI FPM LiteSpeed
Compression Brotli Brotli Brotli GZIP Brotli
CPU limits Very common Low memory Low PHP workers Average None

 
Why you need Cloudflare Enterprise

Because you get Enterprise features like 270+ PoPs, prioritized routing, full page caching, HTTP/3, WAF, and image optimization. 3 problems with most CDNs are their small network (PoPs) and no full page caching or image optimization. For example, WP Rocket’s RocketCDN uses StackPath which was removed from cdnperf.com and doesn’t include image optimization with a mediocre Tbps speed of 65+. SiteGround’s CDN only has 14 PoPs. QUIC.cloud CDN (for LiteSpeed) and BunnyCDN are good, but they still don’t beat Cloudflare Enterprise. Sure, you can pay $5/mo for Cloudflare’s APO, but you’re still missing out on all other Enterprise features.

3 popular hosts with Cloudflare Enterprise

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

 
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 more interested in profits than performance. Please do your own research before getting advice.

Siteground cpu dance

Getting started on Rocket.net for a faster TTFB and no CPU limits

Step 1: Create a Rocket.net account and you’ll be prompted to add a coupon. Sign up with coupon OMM1 to get your first month for $1 (renews at $30/mo or $25/mo when paying yearly). If you sign up with my coupon or affiliate links, I get a commission which I seriously appreciate.

Rocket. Net omm1 coupon

Step 2: Request a free migration. They did this the same day and let me review my website before it was launched with no downtime. For the record, their support is better than Kinsta’s and you can reach out to Ben Gabler or his team (via phone/chat/email) if you have questions.

Step 3: Upgrade to PHP 8.1 and ask support to install Redis (they use Redis Object Cache). These are the only things I did since Cloudflare Enterprise and backups are both automatic.

Step 4: Retest your TTFB in SpeedVitals and click through your pages to see the difference. You can also search their TrustPilot profile for people mentioning “TTFB” where they’re rated 4.9/5.

Kinsta to rocket. Net migrationMoved to rocket. Net vs sitegroundRocket. Net positive review

Rocket. Net facebook review 1Rocket. Net vs kinstaKinsta to rocket. Net ttfb redis

Namehero cloudways rocket. Net
I agree with this for the most part

I was previously on Cloudways Vultr HF which was great, but their Cloudflare Enterprise doesn’t use full page caching (yet) and is $5/mo with annoying challenge pages. Even if their Cloudflare Enterprise was identical, Rocket.net still outperforms them with better specs like more CPU/RAM, Brotli, and LiteSpeed’s PHP (plus better support, easier to use, and usually pricing). While Cloudways is a big improvement than most hosts, you’re already spending $18/mo for Vultr HF’s lowest 1 CPU plan with Cloudflare Enterprise. At that point, the extra $7/mo you’d be spending at Rocket.net is worth it. Rocket.net’s dashboard is also much easier.

Siteground cpu limits joke

For small sites on a budget, NameHero’s Turbo Cloud plan is similar to Hostinger between LiteSpeed, cPanel, and pricing. However, NameHero’s Turbo Cloud plan has about 1.5x more resources (3 CPU + 3GB RAM) with NVMe storage. NameHero’s support/uptimes are also better shown in TrustPilot reviews. This is one the fastest setups on a budget… you get a LiteSpeed server + LiteSpeed Cache + QUIC.cloud CDN, and email hosting. The main con is their data centers are only in the US and Netherlands. If these aren’t close to your visitors, make sure to setup QUIC.cloud’s CDN which has HTML caching (ideally the paid plan which uses all 70 PoPs).

Litespeed vs. Apache cpu usage

Cpu cores on litespeed hosting plansLitespeed cache litespeed server

Ram on litespeed hosting plansNamehero vs siteground feedback

 

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:

78 thoughts on “How To Reduce CPU Usage In WordPress (Make Your Website Run More Efficiently)”

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

      Reply
  1. 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
  2. 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
  3. 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