Bobcares

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

by | Nov 30, 2018

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 Support 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 Support 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 Support 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

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

7 Comments

  1. Vlad The Impaler

    That’s so simple to say “Remove resource hungry plugins”!!!!! Seriously??? You think I wouldn’t do that or others wouldn’t??? But I do not know of any way to determine what amount of resources each plugin consumes.

    There should be a plugin out there which monitors all plugins’ consumption of CPU and RAM but there isn’t! If there is, please name it so we can all benefit from it.

    Reply
    • Sijin George

      Unfortunately, there are no plugins available to show the resource-hungry plugins. It all matters on tracking the recent changes and monitoring WordPress website stats as such.

      Reply
  2. مجله خبری دوستان

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

    Reply
  3. Kenn

    Thanks for your advice/article. Got crazy high cpu Usage problem on an autoblog im running, and SiteGround is going to close my site if i not fix it.
    Will run through all your ideas.

    Reply
  4. M.Sameh Aljabbouli

    Thank you very much
    I face this issue in my website
    when I follow your steps it’s fixed
    Many Thanks

    Reply
  5. Shane McEvoy

    Useful WordPress information, thanks for sharing.

    Reply
  6. Rabius Sany

    Helpful articles indeed.
    I faced the same issue several times.
    Hopefully i got resource article like this.

    Keep up doing good works!

    Reply

Submit a Comment

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

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

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie
_clck, _clsk, CLID, ANONCHK, MR, MUID, SM

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

_reb2bgeo - The visitor's geographical location

_reb2bloaded - Whether or not the script loaded for the visitor

_reb2bref - The referring URL for the visit

_reb2bsessionID - The visitor's RB2B session ID

_reb2buid - The visitor's RB2B user ID

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid
_reb2bgeo, _reb2bloaded, _reb2bref, _reb2bsessionID, _reb2buid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF