
I’ve been trying to optimize this WordPress blog because of the high CPU usage reported by my web hosting. I’ll post a few tips that I do personally on this blog and hopefully if you are trying to find out on how to reduce CPU usage on a WordPress blog, these series of posts can help you out.
One thing that I’ll be writing today are general tips (that you probably have already heard/seen somewhere else) that you can do to reduce CPU usage on the server.
General tips to reduce CPU usage on the server (WordPress blog)
- Upgrade your WordPress to the latest version if you haven’t.
You are probably reluctant to upgrade if it’s already working but note that every WordPress update always contains bug fixes and improvements so there is no reason not to upgrade. - Update all of your plug-ins to a newer version.
They might contain bug fixes (or new bugs!? Check the plug-in discussion to make sure that it’s fine to update). - Update your theme files too (especially if you are buying premium themes, sometimes the author has made an update to your theme). For example, I found out that this blog’s theme, Arthemia Premium, was updated with some optimizations. Also the auto thumbnail generation script used by the theme, TimThumb, also had an update that I applied straight away.
- Do you really need those plug-ins?
I know the plug-ins are nice. I had like 40 of them before I did some cleaning up. Now it’s down to 21 (still a lot but I can’t be apart with them yet). - Are you sure you really need those plug-ins?
Again, after you deactivate “unnecessary” ones, try again. This time though, try to look for a feature in a plug-in that is already incorporated on your WordPress version. This is harder to find and require you to do some research, but sometimes a newer version of WordPress has already covered what a plug-in is doing - Only activate plug-ins when you need them.
For example, you don’t need to activate a Theme previewing plug-in if you are not planning to change a theme. You don’t need to activate a WordPress database backup plug-in if you are not auto scheduling a backup, and so on.

- Install WP-SuperCache if you haven’t. Find out how WP-SuperCache saved my blog from the StumbleUpon effect. Also, turn on the WP-SuperCache compression when possible. (Update: Compression will save bandwidth but will actually add to a CPU load on the server. Thanks to Mister Hobbes on the comment section).
- Reduce PHP/Database calls as much as you can.
Most CPU usage is caused by the number PHP and database calls. Using WP-SuperCache helps this tremendously but sometimes it can’t be helped that your blog still has to do some PHP/Database calls. If you can reduce it though, do it. For example if a plug-in allows you to set an option whether to write a log or not (like number of spam comments caught, etc), then disable it. This will reduce the number of database insertion/update calls. - Reduce the number of Widgets and other components as much as possible.
Although putting a weather widget or other widgets are cool, do you really need them? Besides cluttering your blog and turning visitors off, it can also put a strain on the server. Turn them off! - If all else fail, switch to a simpler theme and check the CPU usage again. I’m quite sure that my theme is a bit heavy (especially with the dynamic thumbnail generation) but before I change it, I wanna fight til the end first!
Unfortunately there are many other tips (you can try Googling for more) but these are the basic ones that I applied. There are other specific things that I do, but I’ll write it on separate posts instead. I’m also interested to find if you know how to block spam comments before they even got inserted to the database. I’ve tried the htaccess blocking codes but they gave me blank screens when I tried to access my posts
Don’t miss my other Reduce WordPress CPU Usage tips that can be found on my blogging guide series page.





{ 36 comments… read them below or add one }
Does your theme generate thumbnails each pageview or are they just created once? It looks like it is dynamic from the url, and you might want to fix that, maybe by adding some sort of cache for the same generated images, etc.
Well it is using a script called TimThumb.php which is an open source one. It already has some caching mechanism to check whether the images have already been generated or not. I’m sure it’s called per image which explained why the usage can shoot to the roof.
“Also, turn on the WP-SuperCache compression when possible.”
bu turning on compression, your CPU usage will increase whereas your bandwidth will decrease. Compression = zipping, imagine zipping every file in your computer and when you need to access them, you unzip them, this may increase your storage space at the expense of processing speed.
You are very correct on this matter, MisterHobbes. I’ve updated my post according to your insights (and I just noticed that I mispelled the title as well *doh*)
Hm maybe it was the reason why my CPU suddenly jumped so high earlier and my account was disabled temporarily as a result
I like to disagree with MisterHobbes’ comment. Its logical to say zipping increases CPU usage, but that is only once. When the same page is accessed again (say another 100 times), the zipped content is sent directly and hence no need to process the compressed data (js,css,images) again, which means effectively it reduces CPU usage
Unzipping will be done by the browser and not the server. I have written a detailed post on the same but the post is scheduled to be published on June 2nd
yes, unzipping is done by the browser. However, the server needs to zip the file before it feeds the browser the gz compressed version. Compressing files is still done on the server side everytime someone visits your site, unless you have some sort of cache for compressed files.
What say you Michael Aulia? did your server load reduced after disabling compression?
It’s hard to tell since I don’t have access on the server and have to reply on the support team to tell me whether it has any effect or not
I guess once a cache is cleared, the plug-in has to compress the post again, meaning it will certainly take some cpu resources to do that. If you have lots of posts and cache is being cleared often, then it can be a hog to the server.
My site got down lot of times but it is due to lot of visitors hitting the site.
Thanks for the points. WIll note it downl.
The first thing which i’m doing after writing this comment is to check whether i really few plugins which i fixed up there in my WordPress admin.
yes there are couple of plugins which i don’t need this time, let deactivate them to reduce WordPress CPU usage. Thanks for the tips michael.
If only we have unlimited CPU power and every one of our reader has a T1 connection, then I guess we can use a hundred of our lovely plug-ins
I hardly use 6 plugins on my blog right now… I even modified some of them so that they doesn’t make unnecessary php calls…. Simple theme always has lower burden on the CPU..
Yeah, you are right. Although the plug-ins that I use don’t have anything to do with the theme, I agree with you on using a simpler theme. I’m switching temporarily in about half an hour to a simpler theme momentarily.
I will suggest try DP optimization plugin from Yoast..That will also help here..
Will look for more optimization tips from you..
I also used wordpress for one of my websites. I find cms made simple is better than this one. You may try it.
@MisterHobbes,
“Compressing files is still done on the server side everytime someone visits your site, unless you have some sort of cache for compressed files.”
I guess we were talking about enabling compression option of wp-super-CACHE plugin, which caches the compressed files as well.
@ Michael Aulia,
You are right, once cache is cleared, compression will happen again. I assume there will be decent traffic in-between the clearings. Why would someone clear the cache often if he/she doesn’t get enough traffic to make use of the cached files?
Hi Michael,
I have been trying to go through all the plugins I had installed and remove the ones I don’t really need. At one stage, I had over 25 plugins installed, but that number is well below 20 now.
I think the Super Cache plugin is a must for any website, no matter small or big. this helps out a lot and you can definitely see the difference, oh well I can.
George Serradinho´s last blog post..Transform your pictures with PhotoFunia
Now that I’ve moved my hosting and can actually see the CPU usage, I might increase my plug-in numbers just a bit more heh heh
Thank you for this useful post. I’m wondering how to reduce PHP/MySQL queries, and don’t know how
I am having the same issues and my site was temporarily disabled. The hosting company wants me to purchase a dedicated server but that is NOT an option so I am doing a lot of what is suggested here. I am a bit confused about the compression in WP-Super Cache. Will this or wont this help? And as far as reducing the PHP/MySql queries I have no clue where to start.
Mark
Hi Mark, sorry for my late reply. Make sure you check my other posts on how to reduce the cpu usage (you can access it through the Blogging guide series page on top).
The compression definitely reduces the bandwidth use but it will increase your CPU usage when it needs to compress the files. So in this case, disable the compression mode if you are experiencing a high CPU usage, but it may not be much
WP Supercache doesn’t work on some shared servers. Try Hyper Cache, it’s easier to configure and works like a charm. Unfortunately gzip ain’t supported on Hostgator shared servers. I would have used it and set the cache to clear after 36 hours.
With regards to the use of too many plug-ins, immediately I find an alternative, I uninstall them.
Hm I remember enabling the gzip/compression option on supercache and it worked fine on HostGator. But I guess I didn’t test thorough enough
It was the damn gzip compression i guess that triggered the throttling for me. I had forgotted i modified index.php in wordpress to gzip everything.
Now wonder my CPU cycle went high now i knw
or maybe time to move to a different hosting?
The is more than 1 hostgator as in eat your money and upgrade, upgrade, you need a vps, you need a dedicated server. Do you ever wonder whey all they know is upgrade to get in your pocket and never do much on their side to make their damn systems run right?
Well that’s what most business do. Squeeze more money from the customers
Recently one of my website banned by my host because of excessive CPU usage, and i found this post , think it will help, am going to try this tips. lets hope for the best.
thanks a lot , i m on bluehost too , and my site performance has gone really bad , i have applies few steps from here
changed my theme and installed supercache and upgraded all the wordpress scripts
Hope you won’t get any of that cpu usage issue anymore
But I like the plugins!!!!
I know… the best way is to move to a different web hosting. After the move, I even use more plug-ins now!
well it is really difficult part , i don’t know what is going on with my blog i have changed theme,limited plugins , i used to have 25 now only 6 are working but still host in saying it is using cpu in excess
Same thing happened to me, buddy. After I move to HostGator, all problems go away. I even use around 30 plug-ins now and CPU usage is still 1-2%
Hi,
Today i got my website account suspended (hosted by justhost.com).My CPU usage went up to 22% of 10% applowed. I have a 3-6 images per post and usign NextGen Gallery i was wondering if i put images on other blog, remove NextGen Gallery and insert image via urls, whould it decrease CPU?
Ex. if i put images on Flickr or similar to it site and than install plugin displaying those images, whould it be better?
Alex
Ouch, sorry to hear that. Are you sure it’s the NextGen Gallery which caused the problem? I’m not sure how it works but inserting image via URLs directly definitely uses less CPU because it doesn’t have to grab the URL info from database
Try turning it off altogether for a few hours (yes, this means you’ll have blank images on the posts, but temporarily) before you decide to change everything. Or install WP-SuperCache on your blog and a few other optimizations: http://www.cravingtech.com/how-to-prepare-wordpress-blog-for-a-huge-incoming-traffic.html
Or if all else fail, it’s your hosting that sucks, sorry to say. I was in this boat and moved to HostGator. Have lots of plug-ins without any problems now.
I used to run my site on justhost.com and I was suspended several times, last time I was suspended due to 40% CPU overload. I have installed W3 Total Cache and DB optimizer and bad behavior , also I have about 5 basic plugins. my site has more than 15 posts on single page and I think that may be the problem. you can see it here [url removed - porn site related, sorry!!]
Few day ago I have moved to vps:
Webspace 30 GB
Port 100Mbps
Transfer Unmetered
Server Quad Core/i7
Dedicated RAM 512 MB
Burstable RAM 768 MB
And now when I have more than 50 visit my site just stop working :S
Daily I have about 5000 visits and that hardy can pay my expensive vps
All images I hot at free image hosts.
I would really appreciate if someone can help me with this. I would consider to pay if someone have really good solution.
Thanks
{ 2 trackbacks }