WordPress is the most renowned platform for professional blogging as well as server related problems. If you were using WordPress on shared hosting for a while, I’m sure that you might have came across CPU related errors. WordPress is so-called the most notorious CMS to handle the CPU resources.
Here we’re dealing with the tips to reduce CPU usage on WordPress blogs. This WordPress high CPU usage fix guide has been proven with my own experiments and I run high traffic blogs in shared hosting without any excess CPU issues. I assume that you are on shared server and learned the basics of WordPress and cPanel.
WordPress High CPU Usage Fix : 7 Unbeatable Ways
1. Remove Unnecessary Plugins
This might be 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 optimisation. 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 show the results in in the form of easily understandable charts.
Try to avoid 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 high load of CPU and increased query time. Think before using them. I suggest you to use nRelate Related Posts plugin instead of YARPP.
Uninstall this plugin after finding which plugin lags your blog. However, you can re install this whenever you want to check the resource again.
2- 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 plugin (Preferably, W3TC), configure every options from its dashboard. It can also be used to flush your temporary DNS cache which is very helpful wherein DNS propagation period.
3- 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 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.
4 – By Optimizing Cron Jobs (wp-cron.php)
Cron Jobs are specially assigned programs to ping the server automatically when there arise a page request. By default, Cron Jobs ping servers in a certain interval of time which causes extra load on the server. Fortunately it isn’t a must do action at all. So you can regulate the time interval of pinging to higher limit.
It noticeably reduces your server resource from the back end. Let’s have a look on wp-cron pinging effect.
If you are getting 50 visitors to your site every hour, and each of them reads 2-3 pages, then wp-cron.php is being called:
50 x 2.5 = 125 times per hour
125 x 24 = 3,000 times per day
3,000 x 30 = 90,000 times per month!
If you have added something on your PHP to load from external source and the external site is down then your page will also load slowly.
How to Optimize wp-cron.php?
First, you need to stop wp-cron.php from running on every page view. Do this by opening the file wp-config.php (found in the folder where WordPress is installed) and add the following line close to the top of the file:
What that does is tell the WordPress engine not to run the wp-cron.php script on every page view, essentially it disables it. Second, you need to create a way for the wp-cron.php file to run on a regular basis. Usually the best way to do this is a normal cron job. Create a cron job in cPanel that runs every hour and have the cronjob run this command:
wget -O /dev/null http://www.example.com/wp-cron.php?doing_wp_cron
Replace www.example.com with your blog
4 – Using Light Loading Themes
Simple, elegant themes can invisibly reduce your database call into a great amount. There are plenty of WordPress themes that boast infinite add on features like inbuilt slider, ad boxes, related posts tweak, subscription pop up etc.
Keep in mind that in accordance with the number of features you use, the chances of high server load are high. I personally suggest Genesis Framework as it’s running on thousands of authority blogs.
5. By Correctly Optimizing WP Database
Databases are something which is very important to every blog. It contains all your posts, comments, meta data etc in tabular form. It indeed a MySQL section.
A poorly optimized database table can annoyingly hamper your blog. It uses unnecessary space to store unwanted files which will certainly lags your blog.
WP-Optimize is a great free plugin to remove post revisions, spam comments, unapproved comments, tables etc. You can save a hell lot space by just running this cool plugin. Remember, a properly optimized database ensures maximum possible speed apart from the server side.
6. By Compressing/Merging Existing Images in your Posts
There’s a saying ” A picture can speak thousand words”. When it comes to blogging, images are most important factor to grab 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 sub domain which won’t affect your page speed, hence faster response from server.
Most of the hosting companies provide image optimization tools in cPanel. You can either depend any of these free tools or use any 3rd party apps. Also if you are posting long articles which possesses 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 comment section if you are getting hundreds of comments in each posts.
7. By Updating 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.