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.
UPDATE: After all these troubles, I found that going for Hostgator web hosting was the best option for me. I have tons of plug-ins now with thousands of visitors a day on a shared hosting. No complains from Hostgator and the CPU usage is only 0.1% when I monitored it.