Need help?

Our experts will login to your server within 30 minutes to fix urgent issues.

Customer support or server support, make your own solution using our support configuration wizard.

WordPress high CPU usage problem? Here’s how to fix it

My WordPress website was recently blacklisted for high CPU usage. What’s wrong with my website?

That was a recent support ticket we received at our Outsourced Technical Support department where we resolve support queries for web hosting providers.

Customer’s websites may get flagged for high CPU usage due to poorly coded plugins, buggy themes, lousy images, etc.

As a result, this has a negative impact on the SEO and website ranking.

Today, let’s discuss how to fix WordPress high CPU usage problem.

 

How to fix WordPress high CPU usage problem?

Let’s see the 14 different tips that you can use to fix the CPU usage of your WordPress website.

 

1) Update WordPress

WordPress regularly releases updates that includes bug fixes, security patches, performance improvements, and more.

At Bobcares, our Hosting Engineers help website owners install WordPress updates and upgrade to the latest version.

As a security measure, we always make sure that backups are available before the upgrade.

 

2) Check Plugins/Themes

Plugins/themes are an excellent option to add new features to your WordPress website.

However, sometimes, these plugins/themes misbehave and result in wordpress high cpu usage problem.

Now, let’s see how we can optimize WordPress plugins/themes to eliminate high CPU usage.

Remove unwanted plugins/themes

We’ve seen cases where website owners install plugins for testing purpose, but forgot to remove them.

These plugins or themes store pre configured settings in the WordPress database which can result in high CPU usage.

Remove resource hungry plugins

Most slow loading plugins which include chats, page builder, stats collector, etc. consume more resources and cause website downtime.

Here, we help customers find the plugins that cause high resource usage and replace them with a better alternative.

Update plugins to stable version

Just like WordPress, plugins/themes are frequently updated which contains bug fixes, performance improvements, etc.

At Bobcares, our Hosting Engineers help customers to identify outdated plugins/themes and help them in updating it.

Remove beta plugins/themes

Only use stable versions of plugins/themes, because early versions(beta or alpha) can have bugs in the code which can cause CPU spikes.

In addition, you should only use plugins/themes from trusted sources with clean and optimized code.

 

3) Use a caching plugin

A caching plugin creates a static version of the website content and delivers it to the visitors.

Static files use less CPU and memory.  Therefore, it can drastically reduce the CPU usage.

At Bobcares, our WordPress Experts assist website owners in selecting and installing caching plugins.

Moreover, we properly configure caching settings such as cache validator, minifying files, etc. to reduce CPU usage.

 

4) Image optimization

Images are an unavoidable part of a website, but the biggest bottleneck when loading websites.

In other words, your images might consume high bandwidth, which in turn negatively impacts the website performance.

Therefore, it’s important to compress and scale the images and remove unnecessary data from these images.

Most hosting control panels, like cPanel, provide image optimization tools that are helpful here.

 

5) Clean and Optimize Database

The database is the soul of your WordPress website, because it stores all the data like posts, comments, etc.

A poorly optimized database can often cause problems with high cpu usage, and slow down your websites.

In addition to that , if a database is bloated with unnecessary data(spam comments, post revisions, etc.), it can take more CPU time to process a simple query.

This, in turn affects the performance of the site.

At Bobcares, we use WordPress optimization plugins to automate the database cleaning process.

Moreover, in VPS/Dedicated servers, we use database optimization tools like mysqltuner.pl or tuning-primer.sh.

It’ll show recommendations as shown in the image and we adjust those parameters in my.cnf file. If it is to optimize tables, we use mysqlcheck command as shown below.

mysqlcheck -o

 

wordpress-high-cpu-usage

WordPress database optimization

 

6) Disable WordPress crons

WordPress cron fires every time someone visits the website.

This is a resource intensive task, which in turn can lead to wordpress high cpu usage problem.

So, the solution here is to disable this WordPress cron and setup a normal cron job that runs every hour or so.

We disable the WordPress cron by modifying the wp-cron.php file as below.

define(‘DISABLE_WP_CRON’, true);

 

7) Enable CDN

By using CDN(Content Delivery Network), static files such as media files, js, CSS, etc. are cached on these CDN servers.

So, when a user requests for an image, it is delivered via these CDN servers. This drastically reduces the CPU load on your server.

 

8) Configure WP Disable

Another effective way to reduce CPU usage is to use WP Disable.

This disables unused WordPress settings that consume CPU such as post revisions, emojis, etc.

Further, it also reduces HTTP requests that can improve the overall website performance.

 

9) Enable Opcode cache

We have seen server load reports showing PHP files consuming CPU.

These are the WordPress PHP files getting executed each time someone accesses your website.

In other words, each page of your site has many sections of PHP code that gets executed again and again.

That’s where our WordPress Experts configure OPcode caching programs that save server resources and execution time by caching an executed PHP code, so that next time it can just serve from memory.

For example, APC is a good OPcode caching program.

We enable this module using the below command and made necessary changes in the configuration file “/etc/php5/mods-available/apc.ini“.

php5enmod apcu

10) Limit WordPress crawl rules

It’s true that your website is crawled by many crawlers, but not all crawlers are useful.

When a crawler crawls the website, it uses valuable CPU cycles which affects your website’s performance.

At Bobcares, we help website owners configure their website to block fake crawlers, set rules that reduce CPU usage, block suspicious IPs and more.

 

11) Limit Google/Bing Crawl rate

Popular search engine crawling is essential for your website, but Google crawlers are resource hungry.

Fortunately, website owners can adjust the site crawl rate for Google and Bing from their crawl control settings without affecting the page rankings.

 

12) Install Heartbeat Control function

WordPress Heartbeat API function communicates between the web browser and the server.

This uses /wp-admin/admin-ajax.php to run AJAX calls from the web browser. As a result, admin-ajax.php creates high CPU load.

To fix this problem, we install the Heartbeat Control plugin and configure the frequency of the Heartbeat API.

 

13) Fix XMLRPC attack

One of the most common reasons for wordpress high CPU usage is the XMLRPC attack.

XMLRPC is a method that helps applications like mobile apps to authenticate before performing privileged actions on the site.

Hackers often abuse it and use for bruteforce attacks or DDOS attacks.

So, our Hosting Engineers fix this XMLRPC attack either by manually blocking the XMLRPC request or by using plugins like Disable XML-RPC.

 

14) Upgrade PHP version

Above all, PHP 7 makes the site faster and more secure.

PHP 7 uses less CPU than any other PHP versions. So, it’s always recommended to use updated version of PHP.

But, not all plugins/themes may be compatible with the new PHP version.

So, before upgrading, we first check whether the themes and plugins are compatible with the new PHP version.

 

Conclusion

WordPress high cpu usage is an annoying problem that website owners may face. Today, we’ve discussed the 14 tips that will certainly help you to minimize the CPU usage of your WordPress website.


PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

SEE SERVER ADMIN PLANS

Submit a Comment

Your email address will not be published. Required fields are marked *

Bobcares
Bobcares is a server management company that helps businesses deliver uninterrupted and secure online services. Our engineers manage close to 51,500 servers that include virtualized servers, cloud infrastructure, physical server clusters, and more.
MORE ABOUT BOBCARES