Start a conversation

Methods To Reduce WordPress CPU Usage

The users of eicra.com frequently ask how to reduce your WordPress CPU load without upgrading your web hosting server? The last thing you’ll ever want is a slow server which might affect your Google ranking, a constant server crash (if you’re on a dedicated server) or your web hosting company shutting off your blog without warning due to excessive usage. Here are the 7 methods I used to reduce my WordPress CPU load and bandwidth without upgrading to a much more expensive server.

 

CPU Usage- What is it?
The usage that a system’s central processing unit incurs is referred to as CPU usage. A shared server is actually a dedicated or virtual machine, which is divided on the basis of bandwidth and disk space. When this shared server exceeds the CPU usage parameter, the web host will suspend that account temporarily. Hence, if you have a WordPress blog, ensure keeping CPU usage to its minimum.

How to lower CPU Usage?
CPU usage usually depends on the amount of request that your server receives. Besides, it may also depend on the number of people accessing your site/blog at the same time. Whatever the reason may be; your objective is to reduce CPU usage.

 


Step 1. Remove Unnecessary Plugins

This might be the first point you would ever see in WordPress CPU optimization. Plugins are the most resource eating materials when it comes to WordPress. Hosting companies usually suggest maximum 3 or 4 plugins but in the live case, it isn’t possible unless we run a story narration blog.

Since we are solely depending on plugins to automate certain processes, it’s really hard to find the plugins which should be avoided.

In this scenario, we must compromise on visual effects and should focus on blog optimization. ie., concentrate on necessary show ups and avoid eye-catching sliders, related posts plugins etc.

In order to find the most resource consuming plugin, you can try P3 Profiler (Which is again a plugin :P). It accurately measures your server resource from head to toe from plugins side and shows the results in the form of easily understandable charts.

Try to avoid the use of badly coded related post plugins. Related post plugins have many issues. Even good plugins in this category like ‘Yet Another Related Posts Plugin (YARPP)’ has many issues.

Many web hosts have banned its use in shared hosting plans. It resulted in a high load of CPU and increased query time. Think before using them. I suggest you use nRelate Related Posts plugin instead of YARPP.

 


Step 2. Minimize the number of WP Crons:

The WordPress Cron job is a resource-intensive task that runs every single time your WordPress is accessed. The best way to optimize the efficiency of your WordPress cron jobs is to disable WP-cron and set up a normal cron job through cPanel which will run every 12 hours or once per day.

You can disable WP-cron by modifying the wp-config.php (located in the folder where WordPress is installed). Open the wp-config.php file, add a new line after <?php, then add the following code on the new line:

define('DISABLE_WP_CRON', true);
 
 

Step 3. Using Cache Plugins

W3 Total cache (W3TC) and WP Super Cache are the most effective cache plugins I’ve ever came across. Though some people suggest WPSC, I should recommend you to install W3TC as it’s loaded with advanced options like minification, database cache, page cache, cache purging, CDN optimization, CloudFlare integration etc.

After installing either of these plugins (Preferably, W3TC), configure every option from its dashboard. It can also be used to flush your temporary DNS cache which is very helpful wherein DNS propagation period.

 

Step 4. Using CloudFlare

CloudFlare is a free blog optimization service which can also be considered as a basic CDN service. Don’t expect too much from their CDN as it accelerates your blog without any bucks. However, you can significantly improve your page loading speed and CPU load.

It works as an intermediate between the blog and the server. Whenever a user requests a page, CloudFlare provides the page without letting the blog from accessing the server contact. It automatically catches your pages from the server side and stores in its own large data servers.

Let’s see an example. Suppose you are going to get some milk from a cow (Physically). How it would be if you get the milk from a milkmaid which has already been taken from the cow? Isn’t it easy? It literally reduces the load of “cow” (Server here) from frequent disturbance. It also provides faster access and you don’t have to walk longer.

In the same manner, CloudFlare grabs your pages from the server and stores in a place (Data centers) where it can be accessed quickly without pinging to the server. That’s all.

 

Step 5. By Compressing/Merging Existing Images in your Posts

There’s a saying ” A picture can speak a thousand words”. When it comes to blogging, images are a most important factor to grab the attention of the readers. On the other hand, it can also be used to gain entry search engine traffic by correctly rendering Alt tags.

But excessive insertion will not only slower your blog but also turns as a nuisance to your loyal readers. Whatever it may be, you may reduce maximum picture additions in your blog. Alternatively, you can host your all images in a subdomain which won’t affect your page speed, hence faster response from the server.

Most of the hosting companies provide image optimization tools in cPanel. You can either depend on any of these free tools or use any 3rd party apps. Also if you are posting long articles which possess dozens of images, you can split the post to 2 or 3 pages with respect to the length of the article. This method can also be used in the comment section if you are getting hundreds of comments in each post.

 

Step 6.Optimize your CSS

By removing unnecessary codes and line breaks, you might have the opportunity to reduce the CSS file size by 50%. Again, this translates into massive bandwidth saving due to the fact that your style.css file is downloaded every time a unique visitor visits your blog. Here is one of my favorite online tool – Online CSS Optimizer or Clean CSS.

 

Step 7. Enable the Default WordPress Object Cache

WordPress 3.0 and higher comes with a feature known as WordPress Object Cache, sadly it is not enabled by default, therefore making this feature somewhat of a mystery.


    • Step 1 – Open your wp-config.php file
    • Step 2 – Insert the following code

      1
      define('ENABLE_CACHE', TRUE);

    • Step 3 – Create the cache directory
 
1
/wp-content/cache/
  • Step 4 – Change the ‘cache’ folder writable permission to 755 or 777

To set it’s expiration time you can add this line:

 
1
define(‘CACHE_EXPIRATION_TIME’, 900);

If you’re using Wp-SuperCache of W3 Total Cache, ignore the WordPress Object Cache feature. Last but not least, use a good WordPress theme, choose wisely, a well coded theme will greatly reduce the number of queries, have minimal W3C error and is Google friendly. Insert this quote to find out the number of queries for different themes:

 
1
<?php echo $wpdb->num_queries; ?>q, <?php timer_stop(1); ?>s

 

 

Step 8.  Update Possible Functions.

Many plugins release newer versions in certain interval of time. Some themes also update as well. Here, if you don’t update these functions properly, it will automatically surpass update requests whenever you load your blog. So update every plugins and themes (including WordPress) as fast as possible.

In short, Always update everything. If there is an update available, you should always go for it. Updates contain security improvements and bug fixes.

 

The bottom line

With every passing day, the technology world is introducing new advancement. And with new advancements, your chances of getting new ideas to lower CPU usage increases too. So, keep yourself updated with the advancements and pave your way to a smoothing performing blog with high traffic surges.
 
 
Choose files or drag and drop files
Was this article helpful?
Yes
No
  1. Support-Agent

  2. Posted
  3. Updated

Comments