How To Fix High CPU Usage In WordPress Before It Hits 100% (Usually Happens On Apache Servers — Use LiteSpeed Instead)

Reduce cpu usage wordpress

Every time I’ve upgraded my hosting plan from high CPU usage, they used Apache servers.

SiteGround, GoDaddy, Bluehost, and Cloudways use Apache which is less efficient than LiteSpeed. Plus, their plans don’t include a lot of CPU cores. I’ve personally had to upgrade from SiteGround’s GrowBig plan to their $120/mo cloud hosting to fix CPU issues. Instead of wasting money (and hours optimizing my WordPress site when it was my host), all I had to do was switch to a (faster) host who uses LiteSpeed servers with more CPU cores, like ChemiCloud.

Sometimes, high CPU usage is caused by factors outside of hosting such as plugins, bots, background tasks, and more traffic. Before blaming your host, make sure it’s not a bottleneck and spend some time configuring your plugins, CDN, and hosting. But if nothing works, don’t get fooled by your host. If you (or them) are able to fix it, great! But if they tell you to upgrade, look into moving to LiteSpeed before pulling the trigger on a hosting plan that still uses Apache.

 

1. Use A LiteSpeed Host With More CPU Cores

Just by switching to LiteSpeed, people have seen a 75%+ reduction in CPU usage. LiteSpeed uses CPU/memory more efficiently, it’s faster, and can handle more traffic compared to Apache.

Litespeed apache cpu usage

Litespeed vs apache cpu usage

When choosing any host, I like to look at:

  • Do they use LiteSpeed or Apache?
  • Do they use NVMe storage which is faster than SATA?
  • Do they use MariaDB which has advantages over MySQL?
  • Do they have scam reports like Hostinger and GreenGeeks?
  • If you also use them for email hosting, you’ll want more inodes.
  • Complaints on TrustPilot about specific issues like high CPU usage.

Taking all this into consideration, this is why I like ChemiCloud. They use LiteSpeed, NVMe, MariaDB, and have a 5/5 star TrustPilot rating. Not only do they include more CPU cores + RAM than most hosts, but they offer a Turbo+ Boost add-on which lets you scale cores + RAM from 3/3 to 6/6. Which means even if you need to upgrade, you can just buy this add-on instead of an entirely new plan. You’re not stuck with the same resources since their add-on offers scalability.

View Spreadsheet


 
Litespeed vs nginx vs apache

Which web server do you use recommendLitespeed cache litespeed serverLitespeed litespeed cache quic. CloudLitespeed pagespeed scoresChemicloud gtmetrix report

Which web server do you useLitespeed on litespeed serverLitespeed cache vs. Wp rocketDivi litespeedChemicloud vs sitegroundChemicloud pro feedbackChemicloud speed ui supportSiteground vs chemicloud comparison

Chemicloud trustpilot

For cloud hosting, I either recommend Rocket.net (what I use) or Vultr High Frequency on RunCloud (for only a few sites) or GridPane (for agencies). RunCloud and GridPane both use LiteSpeed. And while Rocket.net still uses Apache, their specs will greatly outperform similar cloud hosts like SiteGround Cloud, Cloudways, and Kinsta. Especially between their <100ms average global TTFB on Cloudflare Enterprise and 32 CPU cores + 128GB RAM. ChemiCloud also has VPS LiteSpeed hosting but you’ll need to spend an extra $9.95/mo for the LiteSpeed add-on.

Rocket. Net vs cloudways cpu usage

Rocket. Net 100ms global ttfb
Rocket.net averages a <100ms global TTFB (feel free to test mine) and includes 32 CPU cores on all plans

Hosts like SiteGround, Bluehost, and Hostinger are only popular because of marketing and affiliates who don’t know what they’re talking about. But if you look at specs of their hardware, software, CDN, and cache plugin, hosts like ChemiCloud and Rocket.net are clearly better/faster.

Siteground cpu dance your fault

Siteground cloud cpu limits

Siteground cpu wordfence

 

2. Remove Resource Hungry Plugins

Some plugins run background tasks which increase CPU usage.

Any plugin (or plugin setting) 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 left by old plugins as well as other database junk. The image below shows how using many Rank Math modules can add lots of overhead.

See my 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

 

3. Limit Heartbeat, Autosaves, Post Revisions, XML-RPC

These are more background tasks you can limit. WordPress Heartbeat runs every 15-60s, autosaves run every 60s while editing, and a revision is stored whenever you update a post.

I recommend FlyingPress’ bloat settings for this which is also the cache plugin I recommend. They recently released these settings to limit Heartbeat, post revisions, disable XML-RPC, and disable wp-cron (all of which reduce CPU usage). If you’re not using FlyingPress, you can also use the Perfmatters general settings or Unbloater for most of these, but try to use FlyingPress.

Flyingpress bloat settings 2

Limit Heartbeat – if you have the option to disable it in specific areas, I would disable it in the frontend/dashboard, then limit the post editor to 120s since you probably want it there when using page builders, for autosaves, etc. Or paste the code to functions.php after the <?php tag.

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

Increase autosave interval – I increased this to 120s (you could even do 300s). If you’re not using a plugin that lets you do this, you can add the following code to your wp-config.php file.

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

Limit post revisions – since you want a few backups, limit your post revisions to around 5-10.

define( 'WP_POST_REVISIONS', 10 );

Disable XML-RPC – If you don’t use mobile devices to publish content (or use plugins like JetPack), disable XML-RPC. Aside from reducing CPU usage, it also stops brute force + DDoS attacks. If you’re not using a plugin that does this, use Perfmatters, Disable XML-RPC plugin, or paste the code to .htaccess and replace xxx.xxx.xxx.xxx with your IP address in case you need it.

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

 

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

The first step is disabling the built-in wp-cron in FlyingPress (see previous section) or 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.

 

5. Use A CDN With Full Page Caching

CDNs lighten the load on your server by offloading bandwidth to their data centers.

Cloudflare bandwidth

With full page caching, you’re caching HTML which improves TTFB in multiple global locations (which you can test in KeyCDN) while also reducing CPU usage. If you’re using LiteSpeed, you’ll want to use QUIC.cloud (ideally their paid/standard plan which uses all 83+ PoPs and includes DDoS protection). If you’re not using LiteSpeed, use Cloudflare APO. I don’t recommend using SiteGround’s CDN or WP Rocket’s RocketCDN since they either don’t support full page caching or have a history of DNS issues which already caused 2 million sites to get blocked from Google.

Of course, the best CDN right now is Rocket.net’s Cloudflare Enterprise which is free, setup automatically, and includes more Enterprise features than Cloudways/Kinsta like APO, Argo Smart Routing, WAF, and image optimization. Plus, their hosting is faster than both of these.

 

6. Use Your CDN For Firewall + Image Optimization

Using your CDN for security + image optimization also lightens the load on your server. Whereas security + image optimization plugins use resources and increase CPU usage.

A firewall blocks unwanted requests. Cloudflare (WAF), QUIC.cloud, and BunnyCDN all have firewalls. Cloudflare lets you add firewall rules to block bad bots, hackiest countries, etc. They also have rate limiting (paid service) to identify and mitigate excessive requests to specific URLs.

Cloudflare hotlink protection firewall events
See what’s getting blocked in Cloudflare’s firewall events (most of mine are from image hotlinking)

For image optimization, I recommend either QUIC.cloud, Cloudflare Mirage/Polish (included with Rocket.net’s and Cloudways’ Cloudflare Enterprise or on Cloudflare Pro), or BunnyCDN’s Bunny Optimizer. These also typically optimize your images better than plugins (like Imagify).

Bunny optimizer

 

7. Block Bad Bots

Hosting companies love to blame high CPU usage on bad bots.

You can use Wordfence’s traffic report to see all bots hitting your site in real-time. But I recommend deleting Wordfence when you’re done since the plugin can increase CPU usage.

Wordfence live traffic report

Instead, enable Cloudflare’s bot fight mode.

Cloudflare bot fight mode

Additionally, crawler hints save resources by helping search engines avoid wasteful crawls.

Cloudflare crawler hints

 

8. Increase Cache Expiration

Some cache plugins, hosting dashboards, and CDNs have a cache expiration setting.

A longer cache expiration has several benefits, one of them being less CPU usage because the cache doesn’t need to rebuild as frequently. Google recommends setting this to 365 days for static files, but dynamic websites like WooCommerce should generally aim for about 1 month.

Cloudways static cache expiry

 

9. Protect The WP-Login Page

Your wp-login page is a common target for bots/attackers. Even just attempting to login generates additional requests to your server, so it’s best to try and block these completely.

Do not move your wp-login page when using QUIC.cloud’s CDN (for LiteSpeed) since it already protects the wp-login page. However, you’ll want to move it in most other cases.

  • Limit login attempts: control how many times users attempt to login, lockout period, XML-RPC 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.
  • 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

 

10. Try Switching Cache Plugins

FlyingPress + LiteSpeed Cache address web vitals better than WP Rocket + SG Optimizer. If you’re using a LiteSpeed server, use LiteSpeed Cache. If not, use FlyingPress in all other cases.

 
I’ve seen several complaints in Facebook groups about WP Rocket and CPU issues. FlyingPress also recently released this update to reduce CPU usage by 300% when the cache is preloading.

Flyingpress cpu usage reduction

 

11. Limit Preloading + Cache Clearing In Cache Plugins

Preloading is a big reason cache plugins can increase CPU usage. Some cache plugins let you change how preloading works while other plugins don’t (in this case, try disabling preloading).

Examples:

You should only preload important sitemap URLs. Preloading the entire sitemap means tags and other non-critical pages will be preloaded and use resources. Find your sitemap URL (i.e. https://mysite.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 quicker 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 your 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.

 

12. Clean Your Database (Thoroughly)

I briefly covered this in step 2, but cleaning your database can reduce CPU usage.

Cache plugins clean most of it, but WP-Optimize lets you delete tables left behind by old plugins. In the process of doing this, you can also see specific plugins/modules adding overhead. In which case, consider disabling these modules unless you actually need them.

Rank math database bloat

 

13. Install Redis Or Memcached With OPcache

Your host will either support Redis, Memcached, or neither (find their instructions).

You’ll usually activate it in your hosting account (PHP Extensions in cPanel). Next, use a plugin (like LiteSpeed Cache’s object cache settings) to connect it. If your host doesn’t support object cache, use the Docket Cache plugin. OPcache can usually be enabled in your hosting account.

Opcache memcached redis

 

14. Avoid Page Builders On Cheap Hosting

Why does Elementor recommend a 756MB memory limit? Because it requires more resources than Gutenberg and other lightweight alternatives (plus it adds extra CSS/JS to the frontend).

When you combine a page builder that requires more server resources with a hosting plan that doesn’t give you enough… you get higher CPU usage. The same is true for WooCommerce sites.

Elementor memory limit

 

15. Use PHP 8+

Upgrade to the latest PHP version in your hosting account (if you see errors, just revert back). Higher PHP versions are faster on the frontend and more efficient for CPU and memory usage.

Php 8. 1

 

16. Clean Up Your Admin

Other than making your admin look tidy, disabling things can save resources. Try one of these:

Unbloater plugin

 

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

 

18. Keep Email/Web Hosting Separate

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

Emails take up inodes (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 takes up lots of inodes (make sure your plan has enough)

 

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

 

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

Switching to LiteSpeed hosting with more CPU cores can often reduce WordPress CPU usage by 50%+. Also check for resource hungry plugins, background tasks, and offload everything possible to your CDN (including bandwidth, security, and image optimization).

What can I do if WordPress 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.

Which plugins reduce WordPress CPU usage?

FlyingPress, Perfmatters, Unbloater, WP-Optimize, Blackhole for Bad Bots, and WPS Hide Login are all WordPress plugins that include features for reducing CPU usage in WordPress.

Do Apache servers cause high CPU usage in WordPress?

Yes, Apache servers are inefficient compared to Nginx and LiteSpeed. For example, LiteSpeed can handle 2x the capacity of Apache and uses resources more efficiently.

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

Cheers,
Tom

You Might Also Like: