How To Reduce CPU Usage In WordPress: Avoid 100% CPU Spikes, Bandwidth Throttling, And Resources Hugs With 22 Optimizations

All hosting plans have CPU limits.

Your plan only has a certain amount of server resources. If you exceed them, you’ll likely run into 5xx errors and your WordPress site + admin panel slows down because the bandwidth is being throttled. By the time you actually realize this, CPU usage may already be close to 100%.

But before you upgrade, talk to your host and ask if they can spare you temporary resources while you go through this tutorial and optimize your site. There are several easy to reduce CPU in WordPress like eliminating high CPU plugins, background tasks, and offloading resources to Cloudflare. But I encourage you to go through the entire guide since small tweaks with object cache, cron jobs, and paid Cloudflare features (APO, Argo, load balancing) can also reduce CPU.

The other (and more likely) reason is you’re on shared hosting which is infamous for CPU overages. SiteGround (especially their cloud hosting), Bluehost, and most shared hosts are known for these. If you’re sticking with shared hosting, at least use a LiteSpeed server (i.e. NameHero) which is more efficient than Apache/Nginx. Many people (like me) use Vultr HF which has higher CPU clock speeds with NVMe. Some technology is also better for memory usage when comparing Redis vs. memcached, MariaDB vs. MySQL, and PHP-FPM vs. FastCGI.

I don’t want to spam you with “switch your host” recommendations – but it’s a big deal. There are several people who already moved and said it instantly fixed CPU issues (it also did for me).

Reduce cpu usage wordpress

 

1. Check Your CPU Usage

Most hosting dashboards let you check CPU usage.

Reduce-cpu-usage-wordpress
CPU usage should never be close to 100% so your server stays relaxed

Many hosts have tools like AWStats, New Relic, or SSH (use the ‘top’ command) which show how much CPU things are using. Using these tools, you should be able to learn whether CPU spikes are caused by admin-ajax, bots, plugins, cron jobs, or certain websites on your account.

Bluehost awstats website bandwidth
AWstats show websites consuming the most bandwidth
Query-monitor-slow-plugins
Query Monitor shows plugins/queries hogging resources

 

2. Ditch Shared Hosting

TLDR: Cloudways Vultr HF, buying Vultr HF directly from their website and using RunCloud, or LiteSpeed servers (i.e. NameHero or JohnnyVPS) are all solid options. Avoid SiteGround, especially their cloud hosting which is known for CPU issues, EIG brands/Bluehost, GoDaddy, and similar shared hosts. I’m not a fan of Hostinger either.

Why better hosting can reduce CPU:

  • Cloud hosts like Vultr HF have high CPU clock speeds.
  • NVMe is faster than traditional SSDs used on most hosts.
  • MariaDB tends to use memory more efficiently than MySQL.
  • PHP-FPM tends to use memory more efficiently than FastCGI.
  • Redis tends to use memory more efficiently than memcached.
  • LiteSpeed handles CPU spikes more efficiently than Apache/Nginx.
  • LiteSpeed servers can use the LSC plugin with server-side caching.

I use Cloudways Vultr HF which is a popular choice in Facebook Groups. You can check my GTmetrix report, TTFB, or click through my site to see yourself. I moved from SiteGround to Cloudways which cut load times in half and fixed CPU issues (it’s also monthly pricing with no higher renewals). They use Object Cache Pro/Redis with NVMe storage and 44 data centers. Main cons are no file manager/email hosting and their Breeze plugin + CloudwaysCDN aren’t great. I suggest WP Rocket or FlyingPress, Cloudflare or BunnyCDN, and Google Workspace. They do 3-day trials, a free migration, and a promo code for 30% off 3 months. Some people are afraid they’re techie since it requires an extra step to launch a Vultr HF server, but it’s not hard:

Cloudways launch vultr hf server

Siteground-cpu-limits

Siteground to cloudways happy customer

Siteground cloudways cpu usage

Cloudways vs siteground cpu usage

Siteground slow ttfb

Cloudways backend speed

There are quite a few people who moved to Cloudways (mostly Vultr HF) and posted their migration results. You can also see feedback in Facebook groups (click thumbnails to enlarge).

Favorite-cloudways-server

Hostgator vs vultr vs cloudways poll

LiteSpeed can also help reduce CPU usage since it’s much more efficient than Apache/Nginx. It can handle double the amount of websites as Apache and I encourage you to view benchmarks.

Apache vs litespeed namehero test

There are several LiteSpeed hosts but I would try NameHero or JohnnyVPS (WP Johnny’s hosting company). I don’t recommend A2/Hostinger because (aside from their bad uptimes and support) you get more CPU/RAM for cheaper on NameHero, and their Turbo Cloud plan also uses NVMe storage. You’ll be able to use the LiteSpeed Cache plugin with QUIC (see tutorial).

Web server poll

Web server poll oxygen

Siteground vs cloudways vs namehero

 

3. Offload Bandwidth To Cloudflare

Cloudflare is your best friend for offloading bandwidth and reducing CPU.

You can check cdnperf.com and dnsperf.com and you’ll usually find Cloudflare is both performant and reliable (unlike StackPath which was delisted because of major issues). RocketCDN and CloudwaysCDN both use StackPath, so I don’t recommend using those.

How Cloudflare can reduce CPU:

  • DNS: external DNS reduces load on origin server.
  • CDN: offloads resources to their 250+ 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.
  • APO: serves entire website from Cloudflare’s edge network (paid service).
  • Argo: limits number of data centers that ask origin for content (paid service).
  • Load balancing: steers traffic away from unhealthy origin servers (paid service).
  • WAF: firewall improves security and reduces usage simultaneously (paid service).
Cloudflare-bandwidth-savings
Cloudflare bandwidth savings shown in Analytics tab (darker “cached bandwidth” is better)

While most hosts have an option to activate Cloudflare directly in their dashboard, this only gives you basic Cloudflare settings. Instead, you should set up Cloudflare manually by signing up through their website, then changing nameservers so you have access to the full dashboard.

Change bluehost nameservers cloudflare
Setting up Cloudflare manually gives you full access to the dashboard

Now we’ll activate Cloudflare’s CDN. In your Cloudflare dashboard, head to your DNS settings and locate your website. Change the proxy status from DNS only to Proxied (should be orange).

Activate cloudflare cdn
Activate Cloudflare’s CDN by changing your website to “Proxied” in the DNS settings

 

4. Block Bad Bots

Bad bots inevitably crawl your website and waste resources. There are several ways to block/limit bots using Cloudflare (which has a few bot features) or with WordPress plugins.

  • Cloudflare bot fight mode: blocks bots that fit certain traffic patterns. Cloudflare Pro includes super bot fight mode which challenges/blocks automated traffic, excludes static resources, and has JavaScript detections + bot analytics (found under Firewall → Bots).
  • Cloudflare Crawler hints: tells search engines when content was updated, letting them time crawling precisely without wasteful crawls (found under Caching → Configuration).
  • Wordfence – some people have success using it to reduce CPU but it can also increase it especially if don’t disable settings like unneeded scans or limit rows/days live traffic is stored. The live traffic report, rate limiting, and firewall settings can be worth configuring and testing your results. Be careful when using the plugin and disable it if it’s not helping.
  • SiteGround security – while I don’t like them, SiteGround has a security plugin which looks decent with features like custom login, limit login attempts, disable XML-RPC, etc.
  • 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.
  • Blackhole For Bad Bots: read the installation instructions on the plugin page to set up.
  • 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.
  • Limiting Googlebot crawl rate: I prefer not to use this but you can try it here if you want.
  • Cloudways bot protection: several reports of this not working as well as other solutions.
Wordfence live traffic report
Wordfence’s live traffic report shows bots hitting your site in real-time (but also increases CPU usage)
Cloudflare bot fight mode
Cloudflare’s bot fight mode helps block bots (Firewall → Bots)
Cloudflare crawler hints
Cloudflare’s crawler hints prevent wasteful crawls (Caching → Configuration)

 

Hotlink protection prevents people from copying your images and stealing bandwidth (since the image is still hosted on your server). This is common with high res images but can happen to any site. It can be activated in most hosting accounts or Cloudflare’s scrape shield settings. I checked my Firewall Events and saw a few times where it blocked multiple sites in a single day.

Cloudflare hotlink protection

Cloudflare hotlink protection firewall events

 

6. Eliminate High CPU Plugins

Watch out for plugins that run ongoing background tasks.

Reporting (statistics), backup plugins, security plugins, and “scanning plugins” like Query Monitor + Broken Link Checker can increase CPU usage. See my full list of slow plugins then use tools like Query Monitor, WP Hive, and Chrome Dev Tools to find your slowest plugins.

PluginCategoryMemory ImpactPageSpeed Impact
AnalytifyAnalyticsX
Backup BuddyBackupX
iThemes SecuritySecurityX
Broken Link CheckerSEOX
JetpackSecurityXX
Query MonitorAnalyticsX
NextGEN GalleryGalleryXX
Site Kit by GoogleAnalyticsX
WordfenceSecurityX
wpDiscuzCommentsXX
WPMLTranslateXX
Yoast SEOSEOX
Query monitor slow plugins
Find slow plugins using Query Monitor
Usage - chrome dev tools
Find slow CSS/JS/plugins using the Coverage tab in Chrome Dev Tools
Wp hive memory usage
See a plugin’s impact on memory usage in the WP repository using WP Hive

Disable unused modules/settings in plugins – some plugins are module-based or just let you disable individual plugin features. Rank Math, Yoast, JetPack, and several page builder plugins are module-based. Some of these modules (i.e. Rank Math’s analytics) can cause quite a bit of database overheard which you can check in WP-Optimize. In other words, go through all your plugin settings and disable the crap you don’t use, especially if it involves stats, scans, unused modules, or even email notifications (and usage tracking) that have to be sent from your server.

Rank math database bloat
Disable unused plugin modules/features (use WP-Optimize to see tables and do a thorough cleaning)
Wp-optimize-tables
Use WP-Optimize to remove tables left behind by old plugins marked as “not installed”

 

7. Install Redis Or Memcached

Most hosts/cache plugins have an option for Redis or memcached. Redis tends to use memory more efficiently compared to memcached especially for large/WooCommerce sites. You can decide which one’s best for you, but how you set it up depends on your hosting + cache plugin.

The first step is to install Redis or memcached in your hosting account. Cloudways supports Redis (Object Cache Pro) with a drop-in plugin. SiteGround supports memcached in Site Tools and the SiteGround Optimizer plugin. cPanel usually has an option in the PHP Selector settings.

Activate redis cpanel
Activate Redis or memcached in your hosting account
Litespeed cache redis memcached object cache
Activate it in your cache plugin (i.e. LiteSpeed Cache, W3 Total Cache, etc)
Cloudways redis
Cloudways lets you install Redis in their dashboard as a drop-in plugin

 

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

 

9. Remove Bloat

A few bloat removal plugins I recommend:

Perfmatters general settings
Perfmatters has several features to reduce bloat + CPU usage

 

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>

 

11. Don’t Preload Too Many Resources

Preloading too much stuff can increase CPU usage.

One example is the link preloading feature in cache plugins. When users hover over a link, the page downloads in the background. If users hover over lots of links, that’s a lot of preloading going on. The Flying Pages plugin can speed up your site with preloading and has features built-in to prevent server crashes, but you still probably shouldn’t use it if you’re experiencing issues.

Disable link preloading wp rocket

 

12. Replace WP-Cron With A Real Cron Job

The wp-cron is loaded on every page load and schedules automated tasks like publishing scheduled posts, checking for theme and plugin updates, sending email notifications, etc.

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 tutorials. In cPanel, you would open the “cron jobs” tab and use the following line to set a cron job for every 5 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

Add new cron job cpanel

External cron job

Cron job advice

Cron job cloudflare worker

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.

 

13. Limit Heartbeat, Autosaves, Post Revisions

WordPress heartbeat and autosaves should be scheduled to run less frequently while post revisions should be limited. Most cache plugins have an option to disable/limit Heartbeat and Perfmatters can change the autosave interval + max post revisions, or you can do it manually.

Disable/limit heartbeat – creates requests to admin-ajax.php which sends real-time plugin notifications, etc. In case your cache plugin doesn’t have a setting, use the Heartbeat Control plugin. The dashboard can usually be disabled and I increased frontend + post editor to 120s.

Disable wordpress heartbeat control

Top requesting urls
admin-ajax.php creates a lot of requests which can overload the server

Alternatively, you can 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 );

 

14. Check Your Cache Plugin + Settings

Which cache plugin you’re using, how you configure the settings, and what kind of caching it uses (i.e. server-side + dynamic cache) all impact CPU usage. Even certain settings within your cache plugin can impact CPU. And there’s an endless debate about which cache plugin is “best.” Most free cache plugins don’t do a great job at addressing web vitals and aren’t maintained well.

Choose the right cache plugin – LiteSpeed Cache is arguably the fastest cache plugin but can only be used on a LiteSpeed server. WP Rocket is solid, but I recently switched to FlyingPress and noticed a big difference when clicking through my posts. On SiteGround, you would likely use their SG Optimizer plugin and as far as CPU usage goes, you want to make sure the dynamic cache, Nginx direct delivery, and memcached are all working properly in the plugin + Site Tools. LiteSpeed Cache’s and SiteGround Optimizer’s server-side caching can also reduce CPU usage.

Configure the settings – I have guides on LiteSpeed Cache, WP Rocket, and other plugins.

Disable or increase the preload interval – common issue with WP Rocket which often increases CPU usage. Disable or change the preload interval using WP Rocket’s helper plugin.

Wp rocket disable preload cpu usage

Check whether certain settings impact CPU usage

  • Cache logged-in users
  • Separate mobile cache
  • Preload links (instant page)
  • Running “remove unused CSS”
  • Database cache (W3 Total Cache)
  • Guest mode, cache commenters, server stale, crawler (LiteSpeed Cache)
  • Minify/combine are also listed in WP Rocket’s common causes for high CPU

 

15. Keep Email/Web Hosting Separate

There’s a reason some hosts like Cloudways and Kinsta 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 also 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.

 

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

 

17. Decrease Max Execution Time

Most shared hosts set a default max_execution_time of time of 30s (this is ideal to prevent things from hogging resources). In cPanel, you can adjust this in the MultiPHP INI Editor. In Cloudways, you can change PHP execution time in the PHP-FPM settings. Some plugins may require a longer time like backups and JetPack, so make sure everything still works smoothly.

Max execution time

 

18. Rethink Your Page Builder

Elementor made improvements with their Experiments and Divi also released quite a few Performance settings.

Most of these only affect the frontend and their editors can still be slow, especially on shared hosting. I personally moved from Elementor to Gutenberg but GeneratePress, Oxygen Builder, and Kadence theme are all popular alternatives. If using Elementor, try to use the Hello Theme and hard code your header/footer since CSS is more lightweight than heavy page builder code.

 

19. Use Cloudflare APO + Argo

Cloudflare’s APO and Argo are paid services.

APO reduces CPU by serving your entire site from Cloudflare’s edge network while Argo detects real-time congestion and routes traffic using the fastest and most reliable network paths while limiting the number of data centers that request content from the origin server. I would definitely try the APO (I use it on my blog) but Argo doesn’t usually make sense if visitors are local. Cloudflare has APO instructions on their website, otherwise I’ve summarized it below.

APO Instructions

  • Make sure your cache plugin is compatible.
  • Purchase APO in Cloudflare under Speed → Optimization.
  • Login to Cloudflare → My Profile → API Tokens → Create Token.
  • Click “Use Template” (use the “WordPress” option).
  • Click Continue to Summary → Create Token.
  • Copy the token which you’ll need later.
  • Install the Cloudflare plugin.
  • In WordPress, go to Settings → Cloudflare.
  • Enter your Cloudflare email address and API token.
  • In the plugin, click “Apply Recommended Cloudflare Settings for WordPress.”
  • Toggle Automatic Platform Optimization to ON in Cloudflare.
  • Visit uptrends.com and test your website using the www version.
  • Reference the screenshot below to make sure APO is properly working.
  • If it’s not working, try purging the cache in your cache plugin + Cloudflare.

Test cloudflare apo

Cloudflare’s load balancing is another paid feature that can reduce CPU usage. Otherwise, wait a few days and check your Cloudflare Analytics to see how much bandwidth you’re saving. You could very well notice your site speed improve too!

 

20. Avoid SiteGround’s Cloud Hosting

Like other people in Facebook Groups, I made the mistake of upgrading from SiteGround’s GoGeek plan to their cloud hosting which did not fix the CPU seconds issue. I had to pay them even more to add quite a bit more CPU/RAM until I was paying an arm and a leg just to fix CPU issues (and my site wasn’t any faster). Even if you don’t take my recommendation of Vultr HF or LiteSpeed, don’t make the mistake of using SiteGround’s cloud hosting. Definitely not worth it.

If you absolutely must use SiteGround, make sure you configure SiteGround’s Optimizer plugin and that NGINX direct delivery, dynamic cache, and memcached are working correctly.

Siteground shared vs cloud hosting

Siteground cloud hosting problems

Siteground cloud hosting 503 errors to wpx

Siteground cpu limits cloudways alternative

 

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

Run wordfence scan

 

22. Block Comment Spam

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.

 

FAQS

How do I reduce CPU usage in WordPress?

The easiest way to reduce CPU usage is by using Cloudflare to optimize your WordPress site with their DNS, CDN, and features like bot fight mode and APO. Find bottlenecks by checking your error logs and using tools like AWStats or Query Monitor.

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?

Hosting dashboards have tools to check CPU, memory, bandwidth, and disk space usage.

See Also: My Ultimate WordPress Speed Guide

I hope this helped! Drop me a comment with your thoughts. I try to respond to all of them.

Cheers,
Tom

About Tom Dupuis

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

78 thoughts on “How To Reduce CPU Usage In WordPress: Avoid 100% CPU Spikes, Bandwidth Throttling, And Resources Hugs With 22 Optimizations

  1. Hello Tom,
    You are really doing a good job in fact OnlineMediaMasters is like a wp Dictionary what ever we are searching on Google that we are getting here with easy & simple way.

    Recently I have activated clearfy plugin but I see that wp disable have leaved some script on my website like disable author page, post revision & some other too..
    How to remove all those script, should I reinstall and deactivate again??

  2. Hi there, thanks for this. Quick question regarding the Cloudflare WordPress plugin. Is it worth installing this, or should I not in order to save bandwidth and site speed?

    Thanks!

      1. Great, thank you! Would you recommend using WP comments or Disqus with DCL from a performance standpoint?

  3. Love it man! This article got my score way way up from where it started. Countless ideas to get your speed up! Thank you.

  4. Great article, never knew about WP Disable.
    A quick question about that, I’m hosted @ SiteGround on a Cloud VPS, am running SG Optimiser & WP Rocket (as they apparently work well together). I also have my DNS @ CloudFlare. Is using another plugin (WP Disable) along with what I’m already running (seeing as some of the features overlap) overkill, or is there benefit do you think?
    I guess what I’m really asking is would there be any potential conflicts?

    1. Definitely a trial and error thing… cache plugins can be so unpredictable. But yes, I say try it and test your load time. WP Disable has some features not in those other tools which may have benefits.

Leave a Reply

Your email address will not be published.