How to Reduce High CPU Usage In WordPress? 9 Effective Tips

reduce-high-cpu-usage-in-wordpress

Are you worried about finding a solution to reduce high CPU usage in WordPress? You have come to the right place to overcome this common issue by implementing simple strategies.

I have seen some website founders receiving email notifications from their hosting provider regarding CPU usage, saying that most of the allowed usage has been spent and the service will be terminated after reaching the limit.  

I should admit that it is one of the most frustrating moments! If there is trouble accessing the server because of CPU usage, you will lose potential clients, which is a significant revenue loss.

Yes, when you experience a WordPress high CPU usage problem, you may lose visitors due to the site’s unavailability, especially during high-traffic conditions. So, let’s solve this problem quickly! I can suggest some best tips to reduce CPU utilization in the server.

Before getting into my suggestions, I would like to insist on the importance of site speed loading. Due to high CPU usage, the slow website performance ultimately leads to a drop in search engine rankings because of not passing the core web vitals assessments.

So, it is essential to solve this issue as quickly as possible. However, we need to know how and when the CPU is used highly in WordPress sites to resolve the high memory usage efficiently.

Reasons for high CPU usage in WordPress

Many reasons for high CPU usage causes your site to load like Tortoise or even it will be unavailable.

It happens due to unexpected traffic, many corn jobs running, and memory occupied by unused extensions of WordPress.

The below factors will cover the resources used for website construction and business tools integrations for high CPU usage.

  • Web hosting may have shared resources of multiple websites from different locations. That is, many sites hosted in shared hosting need bandwidth adjustment.
  • Too many WordPress extensions are used for site construction and content delivery.
  • Using high-resolution unoptimized images.
  • The hosting service has multiple Cron jobs for your website.
  • Installed WooCommece plugins, Optin forms, and page builders to design your site for high user experience.
  • Usage of Ajax scripts and slider gallery scripts.

These are the reasons for the high CPU usage with WordPress! So, let’s fix it with simple actions!

Effective Tips To minimize CPU Usage in WordPress

In WordPress, it is easy to minimize CPU usage using the best hosting service that gives options for cron jobs control, database optimization, advanced caching methods, image optimization, and CDN availability!

Yes, the hosting server is the heart of a website that influences the site speed in several ways. So, if you host your business site on high-speed managed hosting, reducing the high CPU usage would be straightforward!

To overcome the speed-related issue and heavy CPU usage, I highly recommend a superfast cloud hosting service like Cloudways, as you can scale the server resources as per your site needs.

Note – Most of the tips that I will discuss below involve Cloudways managed hosting to get the job done with minimal effort.

Now let’s see every tip in detail!

1. Remove Slow loading Plugins & Page Builder

The extensions are always a particular part of WordPress to achieve better functionality and beautifully designed websites. These extensions may use REST API for robust integration with WordPress for eCommerce operations, custom page builders, and Membership website form builders.

Using page builders and heavy plugins can cause high CPU usage in WordPress sites. So, you must remove the plugins that slow the site’s load. Make sure to uninstall the unused plugins as well. Cloudways hosting gives easy options to find CPU and memory usage in WordPress. 

How to check WordPress CPU and Disk space usage in Cloudways?

Cloudways has a feature named – application performance monitoring through which you can find Server health, Ram Usage, CPU usage, and disk usage for every application and extension used in WordPress.

Please don’t use any plugin for a website health check-up in WordPress; it will always increase CPU usage.

Cloudways Application Performance Monitoring

This Cloudways feature provides complete details about every application installed in WordPress, and it monitors the CPU usage, memory usage, RAM usage, and Bandwidth usage by every application.

You can monitor server and application status, such as 

  • CPU idle, free disk, free memory, bandwidth usage, and around 16 metrics. 
  • Auto healing restart will update the metric information and status of the server and CPU every 30 minutes.
cloudways-cpu-usage

The application-wise CPU usage helps you find the right plugins and applications for minimum CPU usage and memory access in WordPress.

Apart from Application performance monitoring, Cloudways offers analytics sections for IP requests, BOT traffic, URL requests, and Status codes.

Use these details to find spam IPs for blocking and unwanted Bot crawling identification to avoid the high CPU usage in WordPress.

cloudways-CPU-usage

The unused extensions and applications can be removed for disk space clearance by using this feature. You may choose alternative applications for apps that use high CPU resources. Spam IP requests can be identified and blocked using this analytics feature in Cloudways hosting.

Besides, analyze the high traffic conditions from which IP and URL send traffic to your WordPress website. It would also be easier to manage the website’s availability at high-traffic conditions using the perfect caching techniques for your web pages.

The API-integrated applications such as eCommerce plugins, Page Builders, and Visual composer can also be monitored and removed if it uses a high CPU limit in the application performance monitoring tool of Cloudways.

2. Optimize The Images

The high-quality images provide a fantastic look and feel to the website. Regarding speed performance, using high-resolution images affects the CPU performance for every page load.

The unoptimized large-size images always occupy more disk space and Ram usage while page loading needs resize of images. Image optimization is necessary for fast-loading websites and minimal RAM use during every page load.

It’s better to remove the gravatar images of the WordPress comments section to reduce CPU usage and compress the media file to load faster on websites. The lazy load image is not a good option for quick-loading web pages. Because it always increases the CPU usage until the image is completely loaded on your website.

Use media compression plugins in the media library to reduce the video, image, and podcast file size to minimize CPU usage during every page load.

The WP compress with Cloudways hosting offers automated image resizing, WebP image generation, media compression, cloud backups with CDN delivery, and one-click restore at any time.

image-optimization-reduce-cpu-usage

The image compression techniques are

  • Lossless compression
  • GZip compression,
  • JPEGmini compressor 

Image optimizer adds caches for fast image downloads from third-party cloud storage services.

3. Cron Jobs Control in Hosting Control Panel

Cron Jobs are essential to utilizing high CPU usage for every page load in WordPress websites. So you need to modify the cron job execution settings in the hosting control panel. Cloudways hosting provides simple options for cron Job settings to reduce high CPU usage during webpage reloads.

Cron jobs settings will execute the Linux command periodically to minimize CPU and RAM usage. Not all hosting providers give this preference; yes, you have such an option in Cloudways managed hosting.

It is easy to set up the Cron job using the application management with the help of the Cloudways control panel. 

  • Inside the application management is an option to set up cron jobs for every application for its comment execution. 
  • Cloudways provides basic and advanced settings for cron jobs management.
  • You can set up the PHP, curl, wegt scripts running interval and command-line execution in the cron job settings and configurations section. 
  • It is also possible to fix the predefined interval like 1 hour or 2 hours for cronjob execution for every application. 
cloudways-cron-job-cpu

These settings will avoid the unnecessary execution of Linux commands in every page load, reducing the high CPU usage of WordPress during high-traffic conditions.

4. Integrate CDN for Content delivery 

Too many HTTP requests and multiple stats plugins will increase the CPU usage of WordPress. The image and media content delivery from third-party services can also tweak the CPU usage, especially in high-traffic conditions.

Cloudways hosting also offers CloudwaysCDN for quick content delivery by advanced caching techniques. It reduces the number of HTTP requests by delivering media files through its content delivery network.

The CDNs use parallel processing of image downloads; for this, it uses multiple subdomains for rapid image delivery to user access. Some CDNs can offer reverse proxy servers and advanced caching techniques to speed up web pages.

The real-time analytics plugins and applications can be integrated using REST API in CDN service to reduce WordPress CPU usage. You need to enable the CDN services under the application management sections of Cloudways hosting.

The CloudwaysCDN is an ideal solution to boost site performance by improving the server response time to user requests. If you have used a third-party CDN before enabling Cloudways CDN, you need to remove the existing one; otherwise, it may lead to some problems. 

The CloudwaysCDN setup is simple!

  • Go to “Servers” in your Cloudways account. 
  • Choose an application to manage in CloudwaysCDN under applications management. 
  • Do configuration settings by entering the website and CDN URL with cache settings for faster content delivery. 
  • You may also integrate Cloudflare CDN with the cloudways platform to minimize CPU usage at high-traffic conditions.
cloudwayscdn-low-cpu-usage

Here is a detailed guide to integrate the CloudwaysCDN into your website.

5. Databases Optimization by PHP Update

CPU usage can be affected by the MySQL configuration and PHP version used in the web hosting servers for database management. So how to fix high CPU usage in WordPress by configuring tables in MySQL and updating the latest version of PHP?

The postmeta and usermeta tables in the database can increase CPU usage, and it should be optimized by choosing the latest PHP version for database management.

Cloudways hosting provides a simple path for a PHP version update, and we need to make sure that mysqli and mysqlnd PHP extension installed in your server and MySQL is not installed.  

It is upgrading the PHP version in your Cloudways account!

  • Logged in to your Cloudways account, go to the “Server management
  • Choose the “Settings and Packages” tab.
  • Select the latest version of PHP under the dropdown menu
  • Finally, save the settings. 
cloudways-PHP-update

That’s all; the latest version of PHP is upgraded for your WordPress website for faster execution.

Cloudways uses inbuilt Memcached for faster data access in databases, API calls, and faster page rendering while loading web pages, reducing the CPU load and providing speedier performance. The Memcached data is processed without disrupting the database, making faster execution possible.

6. Use advanced Cache

The best caching methods, such as 503 forbidden errors and slow PHP processing, will reduce high CPU usage problems. Database connection errors can be solved using the advanced caching methods Cloudways hosting uses.

This managed cloud hosting uses varnish, Nginx proxy server caches for faster content delivery to the user request, and the HTTP request can be done faster with its HTTP/2 feature. A faster database connection can be achieved using a Redis cache combined with an Apache server.

cloudways-varnish-lower-cpu-usage

Accessing the Memcached raw data is more likely without connecting with the database. So you could achieve faster execution of web pages with lesser CPU usage in WordPress blogs or websites. The Edge page cache has recently been introduced to lower your TTFB and LCP.

The Breeze WordPress cache plugin of Cloudways can reduce high CPU usage by internal caching operations, minification of scripts, and Gzip optimization in one place. Its pre-installed varnish cache will decrease the page loading time with lesser database connection usage.

  • The breeze cache is used for the minification of scripts by breaking larger javascript into smaller ones for easy loading. 
  • It removes the render-blocking scripts and their execution.
  • It cleans and optimizes the database. As a result, reducing the database’s size and response time that can minimize CPU usage during high-traffic conditions.
  • The Gzip compression used to download the media file also speeds up your site performance with Cloudways hosting.
breeze-limit-cpu-usage

7. Post revisions and third-party comments system

It is possible to lower the CPU usage by disabling post revision in WordPress. It will reduce the usage of database limits. Usually, all the revisions are stored in the database to avoid page crashes during the post-update. The database space will be increased by disabling the post-revision in the wp-config.php file.

The post revision can be disabled or limited to a certain number to avoid data loss during the unexpected closing of web pages. The below codes should be added to the wp-config.php file. For disabling post revisions, add the below line.

define('WP_POST_REVISIONS', false);

Limiting the revisions can also be the backup for the post. So, limit the number of post revisions to 2 by adding the below code to the wp-config.php file.

define( 'WP_POST_REVISIONS', 2 );

The WordPress comments system always uses multiple HTTP requests from the comments gravatar from various websites. If a web page has many comments from different comments, respondents need too much time to load the web page.

So to avoid multiple HTTP requests in the comments section, the best replacement is a third-party comments system. The Facebook comments system is a fantastic option for consideration, and the time taken to load comments is faster than normal in the Facebook comments system.

The spam comments are protected using the IP spam protection available in the Cloudways hosting. The best security methods used in Cloudways can protect wp-admin with two-factor authentication. 

We can also do wp-admin protection manually by running a MySQL query in the database to replace the wp-admin username. Run the below code for changing the wp-admin username.

UPDATE wp_users SET user_login = 'YourNewUsername' WHERE user_login = 'Admin';

Regular patching can help protect against spammers and malicious attacks.

Cloudways uses the best anti-spam plugins, such as 

  • Akismet
  • Antispam Bee 
  • Cerber Security

 For filtering spam comments, IP blocking, choosing languages, limiting login attempts, auto-spam comment deletion, and user session managers to avoid automated spam comments.

The malware and spyware-attacked websites may slow down the process by executing malware programs on the server side. So, whenever the web page loads CPU runs with large spyware and malware programs. 

More memory space can consume by this software. The protection against the spammer should monitor the webserver on a 24×7 basis. Cloudways provides dedicated firewalls and bot protection for DDoS protection.

8. Clear Database & Avoid application needs many resources

The eCommerce plugins, analytics, tracking applications, and page builder theme always used multiple resources to design websites and integrations special features for our business application.

Good online store websites need elegant design and awesome templates for eCommerce operations and product display. The theme for building an online store must have page builder options with various design elements and pre-designed layouts for product pages.

It must also integrate plugins and web applications for eCommerce functions such as shopping carts, sales orders, payment forms, and product shipping methods. It also needs CRM integration for customer management and upselling the products.

These resources should occupy high CPU usage in WordPress websites during purchases or online shopping. So these resources should be restricted to reduce the high CPU usage of WordPress.

Cloudways provides application management sections to find CPU usage, disk space, and memory usage by integrated tools for business applications.

The high CPU usage applications and tools should be disabled and replaced by many other applications available for the same functionality the business websites require.

The disabled applications and tools have stored data in the MySql databases, slowing the data transfer between the database and users.

Therefore, I suggest you use the WPOptimze plugin to clear data and tables inside the database during the extension installations.

wp-optimize-reduce-cpu-usage
  • Cleans the database and compresses the images by Gzip compression
  • Caching used for HTML, CSS and JS files reused in the browsers.
  • Minify and combine CSS and JavaScript in wp-optimize improves the speed.

It has tools to optimize the MySql tables in the database that can reduce CPU usage to achieve faster web page execution.

You may also manually clean the database by running SQL codes in phpMyAdmin for junk comment Metas, Post revisions orphans, unused tags, and wp-admin user name replacement. 

The junk entries from comments orphans and data from removed comments will be deleted by running this query in phpMyAdmin.

DELETE FROM wp_commentmeta WHERE comment_id
NOT IN (
SELECT comment_id
FROM wp_comments
)

Ensure to delete the post revisions stored in the database using the below query for database clean-up.

DELETE a,b,c FROM wp_posts a WHERE a.post_type = 'revision' LEFT JOIN
wp_term_relationships b ON (a.ID = b.object_id) LEFT JOIN wp_postmeta c
ON (a.ID = c.post_id);

The unused tags and tags clouds are removed from the database by running the below query. 

DELETE FROM wp_terms WHERE term_id IN (SELECT term_id FROM
wp_term_taxonomy WHERE count = 0 );
DELETE FROM wp_term_taxonomy WHERE term_id not IN (SELECT term_id FROM
wp_terms);
DELETE FROM wp_term_relationships WHERE term_taxonomy_id not IN (SELECT
term_taxonomy_id FROM wp_term_taxonomy);

These methods can clean the unwanted data in MySQL databases and improve CPU functionality. Check my detailed article about Database optimization to get a clear idea!

9. Block Unwanted Bots & Reduce Third-party requests

Several web spiders crawl our web pages and send traffic to them. Sometimes we may receive unwanted traffic from different bots. This irrelevant bot traffic can be identified by Cloudways hosting, and yes, it shows the traffic sources and its bots for web traffic.

cloudways-bot-protection

You can disable such crawler bots and minimize unwanted traffic from various places around the web. Also, disable the cron job and block specific IPs for not receiving traffic and not crawling our web pages from those blocked bots, and it can reduce high CPU usage during page loads.

Minimize HTTP Requests

The more HTTP request in a web page needs time to connect with different servers and get the data from those servers. At this stage, use DNS prefetching in the hosting platform to reduce HTTP requests during webpage loading.

Using third-party codes may slow down the web page performances and increase CPU usage during high-traffic conditions. The codes might be from Analytics, Google fonts, Youtube video embedding, and Facebook, which need multiple HTTP requests to process the web pages. 

So while constructing online stores, the uses of youtube videos, different font usage, multiple customization elements from visual builders, and prebuilt templates are needed to be analyzed, and use fewer resources for lower CPU usage.

The bandwidth and CPU consumption of these resources has been identified in Cloudways application management sections. You may choose the right analytics and tracking tool for customer management and sale tracking.

The prefetching DNS third-party scripts can improve the website performance when the tool is necessary. The resources for business applications should consider the CPU usage of WordPress for faster loading webpage creation.

Wrapping it up: How to Reduce WordPress CPU Usage?

High usage CPU in WordPress can cause 503 errors in database connection, slow PHP processing, and multiple HTTP requests; all these culprits can increase the page load time, which is a serious issue for SEO and user experience.

Integrating complex scripts, plugins, page builders, and third-party business tools by REST API can increase CPU usage on WordPress sites. Just check the CPU, memory, and RAM usage with bandwidth availability in Clowdways hosting and optimize the resources to fix this problem.

The unused plugin removals, optimizing media files, using CDN for content delivery, Cache for faster connectivity, Database optimization, and Cron job management – all these tasks can be handled by Cloudways hosting to reduce high CPU usage WordPress.

by Sakthi
Sakthi is a thoughtful guy who specializes in WordPress Setup & Design. He is interested in designing the functional & attractive WordPress themes for the Digital marketers & Bloggers and helping them attain their goals with a tailored site. Look his ThemeForest Portfolio.

2 thoughts on “How to Reduce High CPU Usage In WordPress? 9 Effective Tips”

  1. Hi Sakthi,

    It was an amazing article! I have been struggling with this for some time, and you share a lot of relevant information about why it happens and how can I minimize it. Thanks a lot for sharing such an in-depth resource. The process and solutions sound simple to follow, and I will be trying them out very soon. I appreciate you putting together this article, it has been a major help, and I will share it within my network to help others as well.

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

    Reply

Leave a Comment