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 come across CPU-related errors. WordPress is so-called the most notorious CMS to handle CPU resources.
Here we’re dealing with tips to reduce CPU usage on WordPress blogs. This WordPress high CPU usage fix guide has been proven with my experiments and I run high-traffic blogs in shared hosting without any excess CPU issues. I assume that you are on a 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 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 a maximum of 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 that 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 Profiler1 (Which is again a plugin :P). It accurately measures your server resources from head to toe from the plugin’s 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)’ have 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 the nRelate Related Posts plugin instead of YARPP.
Bonus Tip
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 come across. Though some people suggest WPSC, I recommend you 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 during wherein DNS propagation period.
3- Using CloudFlare
CloudFlare is a free blog optimization service that can also be considered 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 preventing the blog from accessing the server contact. It automatically catches your pages from the server side and stores them in its 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 got the milk from a milkmaid that has already been taken from the cow? Isn’t it easy? It 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 they 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 arises 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 a higher limit.
It noticeably reduces your server resources from the back end. Let’s have a look at the 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!
[Source:http://www.boltwebhosting.com/wordpress-optimization/wp-cron-php-how-to-stop-it-from-running-frequently.html]
If you have added something on your PHP to load from an 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 adding the following line close to the top of the file:
define(‘DISABLE_WP_
CRON’, true);
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 regularly. 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 by a great amount. There are plenty of WordPress themes that boast infinite add-on features like inbuilt sliders, ad boxes, related post tweaks, subscription pop-ups, etc.
Keep in mind that in accordance with the number of features you use, the chances of a high server load are high. I personally suggest Genesis Framework as it’s running on thousands of authority blogs.
5. By Correctly Optimizing the WP Database
Databases are very important to every blog. It contains all your posts, comments, metadata, etc in tabular form. It is 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 lag 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 of space by just running this cool plugin. Remember, a properly optimized database ensures the 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 a thousand words”. When it comes to blogging, images are the 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.
However excessive insertion will not only slow your blog but also turn into a nuisance to your loyal readers. Whatever it may be, you may reduce the maximum number of 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 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 for 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.
7. Frequently updating files
Many plugins release newer versions in certain intervals of time. Some themes also updated 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 plugin and theme (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.
Takeaway
Here I’ve mentioned the top 7 tips to reduce CPU usage on WordPress blogs. There are so many tiny tips that will help you build a shared hosting blog apart from this. Just implement it and get rid of server errors. I expect your valuable comments and feedback for this article. Also, take a while to share this post as well. Happy blogging.:D
- From 10/13/22 this plugin is no longer available. ↩︎
Awesome post buddy, I didn’t knew about Cron.php. Now I would surely customize it!
Hi Aditya. WP Cron can dramatically reduce load up in servers if you do correct optimization. Do well and let me know if you caught any error.
Great information brother . It will save lots of shared hosting accounts from getting banned.
Hi Arup, Thanks for being here. You’re right, nowadays, lots of blogs are being banned due to excessive server resource usage. Hope these tips will help them to build a risk free blog.
wow nice tips, i was using WPSC plugin but now i am thinking to change WPTC plugin thanks for these nice tips….
I’m glad you liked this post. When compared to WPSC, W3TC has many more features and configurations. You had better try the latter and check whether it reduces your CPU load. Thanks for commenting Jawad.
Hey, I was just wondering where your site was hosted at? It loads pretty quick. Could you provide some insights on it?
Hi Sid, thanks for this wonderful resource.
1. I am using just 5 plugins.
2. I use Total Cache with Max CDN
3. I created Cloud Flare account, waiting to watch some results.
4. How to optimize CRON jobs? I have absolutely no idea. Couldn’t figure it out from your explanation.
5. Am using Elegant Themes
6. Used plugin and optimized database.
7. How do I transfer existing images to a sub-domain? Do I need to change the image link for every post published since 2011?
8. All themes and plugins updated.
After doing these, there were 100% CPU usage twice in the last 60 minutes; definitely better than 5-6 times but I need to do more.
I see a lot of errors in log file, like –
[30-Apr-2013 14:34:02] WordPress database error MySQL server has gone away for query SELECT * FROM wp_comments WHERE comment_approved = ‘1’ AND comment_post_ID = 4444 ORDER BY comment_date_gmt DESC made by require(‘wp-blog-header.php’), require_once(‘wp-includes/template-loader.php’), include(‘/themes/Basic/category.php’), get_template_part, locate_template, load_template, require(‘/themes/Basic/includes/defaultcat.php’), get_template_part, locate_template, load_template, require(‘/themes/Basic/includes/postinfo.php’), comments_popup_link, get_comments_number, apply_filters(‘get_comments_number’), call_user_func_array, et_comment_count, get_comments, WP_Comment_Query->query, W3_Db->query, W3_DbCache->query, W3_DbCallUnderlying->query, W3_Db->query, W3_DbProcessor->query, W3_Db->default_query
[30-Apr-2013 14:34:02] WordPress database error MySQL server has gone away for query SELECT * FROM wp_posts WHERE ID = 4445 LIMIT 1 made by require(‘wp-blog-header.php’), require_once(‘wp-includes/template-loader.php’), include(‘/themes/Basic/category.php’), get_template_part, locate_template, load_template, require(‘/themes/Basic/includes/defaultcat.php’), get_thumbnail, wp_get_attachment_image_src, image_downsize, wp_attachment_is_image, get_post, WP_Post::get_instance, W3_Db->query, W3_DbCache->query, W3_DbCallUnderlying->query, W3_Db->query, W3_DbProcessor->query, W3_Db->default_query
All this is beyond my understanding 🙁
~ Chitra
Hi Chitra. It’s kinda weird issue as far as I think.You didn’t answer me why you haven’t move to HostGator. You’re using just 5 plugins right? In this blog, I’m using almost 20 plugins and I’m not even using any CDN like MAX. And I’m sure you can expect better result from CloudFlare. It reduces the overall bandwidth to a great extent. And elegant themes are class ones and I’m not sure whether it causes any problem. And as an answer for your 4th and 7th queries, I will be posting the complete guides on Cron job optimization and subdomain image hosting. Stay in touch . 😀
Hi Sid,
Thanks for sharing this useful information.
I’m use shared web hosting and there are 3-4 blogs hosted there. When I do some tweaks with my files, the CPU usage goes 100% and all other blogs goes down.
And from my experience, Hosting images on a sub-domain and using cloudflare helped me a lot.
Your tips really helped me in reducing CPU usage. Thanks for the great share!
Yeah, hosting all images in a sub domain is the best way to reduce load in a WordPress blog. I will be posting a complete guide on this. And thanks for commenting and glad to hear your appreciation. Stay in touch.
excellent article sid,
you have covered most of the tips.
The cache plugin is an absolute must, i have seen strong vps and dedicated servers going out of service due to not having a cache plugin for their wordpress blogs.
will check out the other options too, am on a VPS from hostgator, so far the cpu usage is not an issue,
cheers!
Much delighted to hear that Bro. Glad. Cache plugins can reduce up to 60% load and hence it’s so important. As you are on VPS, you won’t be getting any problems. This article is mainly meant for shared hosting users. Thanks a lot for your time and stay in touch.
It is a great information.
Thanks a lot for this.I am very interested about web hosting.I hope you will post more about web hosting.
Blogger Zindabad :p
All these issues are known except CRON Job. Another factors you just missed from this wonderful tutorial is – losslessly compressed Images and programming errors in wp-themes like proper use to XHTML tags and CSS.
One more issue which is not even answered by the pros are – how much cloudflare affect the performance of your site as i am not able to measure any significant changes after implementing this on my shared hosting(Hostgator). Waiting for your kind attention
Thanks for letting me know the point Rakesh. Poorly coded themes can definitely ruin the blog in all aspects, say security and page speed. Anyway, I will be adding it very soon. Also, when it comes to CloudFlare, it definitely helps to reduce bandwidth without any doubt. You can check it at the CF dashboard. But I don’t know whether it helps to improve page speed. But I think using CF along with cache plugin can make wonders, hence it’s even suggested by hosting companies.
Great guide for reducing cpu usage bro! First time read about wp crons and how to use it to reduce load time
WP Crons optimisation is really effective. Do let me know after you try this.
This post was awesome! I will try the cron part, since the time I have started using Google pagespeed my blog has been somewhat fast but admin panel is almost slow as a crawl should I use cloudfare along with it or should I remove it to only use cloudfare ??
Slow loading admin panel is common as you’re in shared hosting but the blog will load faster than the dashboard. Here, cloudflare doesn’t have any role. It just store blog pages and nothing else. I think you’re on hostgator right?
Lol, hostgator 😛
Bitch please, I am on the slowest servers of the planet!
I am a Godaddy user! 😀
BTW Happy birthday again 🙂
You must be proud of that. 😛 LOL. Switch to BH or HG ASAP after your plan’s expiry. Then feel the change. In BH, dashboard loads much faster than HG. 😀
great post sid…that cow and milk example was awesome. i am too worried about my page speed. recently i moved to hostgator dedicated server but still i want good page laoding time. i am using cloudflare and low res images. will try some of the tips you suggested..and please publish that post about “hosting images on sub domain or other places” ASAP..thanks..
Thanks for your compliment Prabhat. I will surely publish article on hosting images on subdomain as it’ll reduce the load time significantly. Keep visiting and thanks for your comment. 😀
You have listed awesome methods.Good Job man.
Thank you very much for the comment. Keep visiting.
CPU limit is the main restrictions when we consider shared hosting,i too had the same problem when traffic begins to rise in my blog,i faced suspension from my host due high CPU usage.Then tried to find the host that doesn’t have this creepy problem,every time vps hosting surfaced but I never took it due to its cost.
I finally found a new category in hosting called litespeed type,these type of hosting doesn’t have any CPU usage limit but it was also costly,atlast I found a hosting company named veeble which offered litespeed at very low cost,now the intresting part is that they are from Kerala,from where you and me are from.
Hi
Nice info on High CPU Usage I have only just noticed this problem in my Cpanel I Have recently put the WP Super Cache plug-in And altered my Crone Jobs this as slightly dropped my CPU usage was at %50 plus
Now down to %40 plus so got it down by about %10
Great stuff man… thanks.. 🙂 i was wondering why my blogs speed has gone so low… Gonna try your advice now.. 🙂
Thanks Smaran . Do try these tips and let me know if you could improve your blog speed.
Excellent and very useful post! Well, only 3 or 4 plugins is very difficulty as plugins boost the entire power of WordPress blog, but it’s good to use less plugins as possible. And yes, optimizing the database is also very important and WP Optimize is a great plugin to accomplish it. Thanks for share and tweeted 🙂
Hi Nizam,
Thanks for dropping by!
Hi,
I didn’t know that Cronjob.Php could also do wonders to optimize the blog performance. Really informative article specially for serious blogges who don’t want to compromise on providing best experience to their visitors.
Thanks a lot Tauseef. Glad it helped you. Do share it if possible. Visit again
thank you so much dude.recently i have purchased shared hosting account from hostgator.my site traffic is only 3000 page views per day, but my cpu usage shows 80/100 %.then i have made some changes as per this articls.now my cpu load is 25/100 %.thank you so much.
Hello my friend! I want to say that this post is awesome, nice written and include approximately all important infos. I would like to see more posts like this.
Thanks for this awesome info Sidharth, Worked for my site.
Thanks again.
You’re most welcome, Sandeep. 🙂