WordPress CPU Usage and the July 2007 Report

Samir Bhardwaj dot Com monthly reportIt is that time of the month again. Three months on in this personal site experiment, and it has been a bit of an adventurous month, even if a slower one on the traffic front.

Traffic

Traffic levels reduced even further this month. There were no sudden spikes or surges, but the steady trickle continued for my ever popular article on Taking Professionl Photographs. Other articles got some action too, most of which are mentioned in the Best of SamirBharadawaj.com list in the sidebar. Check them out.

Over all, my traffic reduced by half from last month’s average, but that statistic is very skewed by the fact that the first week of June had my higest traffic figures by many magnitudes, as compared to the weeks that followed. It has really been more of a gradual decline rather than a dramatic crash. Also, part of the traffic reduction might have to do with the server troubles I had during the month of July, which I will talk about shortly.

Blog Carnivals

Due to my increased submission activity over the past month, it was simply not feasible to wait for an entire month to list blog carnival inclusions for articles on this site. So, on two different occasions in July, I posted lists of links to the various carnivals. Those lists can be found here:
Carnivale! July 18, 2007
Carnivale! July 31, 2007

CPU Load Adventures

Towards the middle of the month I got a dreaded email from tech support at my web host Lunarpages that my account was contributing too much to the CPU load on my server. But as was my previous experiences with the support staff, they were extremely helpful and methodical about the issue. They had seamlessly moved my sites to a temporary holding server while I figured out what I could do to reduce the load and bring my account back into compliance with the usage limits.

I host a few sites at my account but all the others are really in the test phase and act more as holding spots for now. I was pretty sure my other sites had no chance of causing the computational load since they got almost no traffic. That meant that this very site, and specifically some element of my WordPress blog install was causing the trouble. The problem was that even back then I knew I was getting the least traffic I had ever gotten and so this was the most unlikely time for the core of WordPress to be leeching on server resources.

I set out to figure out what had triggered the Intel-spasm, with the ever available CPU usage reports and help from the Lunarpages team. My server logs showed no spike in activity, but I knew something had to have caused the sudden change so I dug deeper. Finally, I went to Google’s Webmaster Tools and there discovered that the GoogleBot had come visiting on the day in question. But, I knew that that in itself was not a remarkable occurance. The GoogleBot visited often without setting off any alarm bells, so what was so distressing about this particular occasion?

Ultimately I narrowed it down to the fact that I had the Global Translator Plugin running on my site. The plugin allows a site to be automatically translated into other languages, along with the ability for search engines to crawl that translated content. Like others I too realised the need to enable caching in the plugin to prevent access errors very early on. This meant that the translation was stored on the server rather than carried out dynamically with every request. It made things a bit faster and less intensive for the translation sites, but what about my server? It would all be fine if regular browsers hit the translated pages erratically and the translated pages were cached over a period of time, but when a search bot sequentially looks through hundreds of translated pages which haven’t been cached, suddenly the server has to deal with the mammoth task of reading, fetching and creating cached versions of hundreds of pages at one go. To the best of my knowledge and guess work, that is exactly what happend on the fateful day, and it shot my server CPU usage through the roof setting off all the right warning lights over at Lunarpages.

I removed the translation plugin, and in a few days the Lunarpages support staff reinstated my account into the original server because CPU usage had reduced to acceptable levels. It is a shame really, because almost all of my site including the cumulative mass of thousands of translated pages across many languages had been indexed by Google over the two preceding months. I was even getting a trickle of traffic through foreign language searches which would have increased with time. Now I have been forced to forego that and negatively affect my search engine status due to the large chunk of missing pages.

I might try this or a similar translation plugin again in the future because I still like the idea, but I won’t tackle that untill I have some way to prevent something like this from happening again. In the meanwhile, after the fact I also loaded WP-Cache to run more universal caching on the WordPress site just to be extra safe.

Over all no harm done, other than the search engine set backs that I have yet to fully fathom. I certainly learnt a few lessons in web hosting, and my thanks to the good people of the Lunarpages tech team for all their help along the way.

ToDo

Traffic, traffic, and traffic. The most important asset of any site, and I am in need of plenty of it. That is what I need to work on, along with plenty of new content. I really have given up on any artificial rules about daily posting frequency, because at the end of the day that is simply not the way I work, and forcing myself to stick to that kind of schedule will just make me miserable. Instead I plan on sticking to coming up with truly useful and well-put-together content. That will satisfy me more than anything else and hopefully the readership will follow with a little marketing. Plenty of plans brewing on that front.

Part of the long term plan of growing an interested and engaged audience with good content is to increase RSS feed subscribers. One step I took towards that this month was to convert this site over to a full text RSS feed so that more people might sign up for the updates. If you haven’t done so yet, please subscribe to my full feed RSS to keep track of all the great stuff coming here soon.

Samir Bharadwaj dot Com ranked number 1 by Technorati glitchMeanwhile, on a more frivolous note, John Chow mentioned a passing glitch over at Technorati that (at least at the time of this writing) was displaying every blog as ranked number 1, and so also included in the Top 100. Woohoo! The requisite screenshot was taken for posterity, ego boosting, and all those chicks I plan on impressing with my little high-resolution photographic glossy-paper print out of my new found faux Technorati success.

Watch out ladies. My Technorati rank is bigger than yours.

Comments
  1. Thanks for the tip about WP-Cache. I just got the dreaded “too much CPU usage” email from Dreamhost last week, and have been trying to figure out how to reduce my usage, too. I’m going to give the plugin a try and keep my fingers crossed for better stats in the next few days.

    1. Maggie, glad you found this helpful and thank you for visiting. The whole CPU usage issue is really a very important one now with a large number of us bloggers on cheap shared hosting accounts with strict limits. Also, more and more complex functions and interactive features are being included into blogging software and content management systems, all of which put a greater strain on the server CPU.

      For WordPress, the WP-Cache plugin really is the simplest and most comprehensive way to reduce server load, so I’m sure it will work in for you as well. You can even tweak the effect further by changing the settings for the plugin in the admin area. If for example, you don’t update your blog several times a day and you aren’t getting many comments, you could set the “Expire time” setting to more than an hour (3600 seconds). But generally speaking the defaults should aready have a drastic effect in reducing your processor load.

      Best of luck with the hosting issues and hope to see you around here often.

  2. Great post, and the reason why I’m here is that my account has been suspended at Hostgator too. I have something like 10 WordPress blogs, receiving about 20 to 30 visitors per minute in total, with no fancy plugins.

    CPU usage on my account has exceeded the % limit, and I think it’s time for me to move into dedicated hosting.

    Support staff at Hostgator seems to suggest that the $10/month plans are only suitable for a few blogs of recreational nature.

    1. Hi David, sorry to hear about your hosting problems. I think it is getting to be quite a common issue now that there are more of us with multiple blogs and multiple projects that we work on simultaneously.

      I can see the point-of-view of the Hostgator staff regarding $10/month plans being only suitable for recreational blogs, but I still think most of these situations can be solved with some optimisation.

      The problem is that dynamic sites require a lot of CPU and database activity to run in their default un-cached mode. For example you said you had 10 WordPress blogs getting 20-30 visitors a minute. That might not be a huge load for the Apache server to handle, but in WordPress, each visit to a page results in anywhere from 10-50 MYSQL database queries depending on the theme and plugins you are using. That would mean your account could be dealing with something like 1000 database requests per minute. That is a lot.

      The best and simplest solution to this is installing the WP-Cache plugin. This saves each page as a static page for a fixed period of time and/or until something on the page is changed. The default cache time is 1 hour, which means each page on your blog will be generated only once in an hour rather than many times a minute. This leads to a huge saving in CPU cyles and database queries. If you have a site which doesn’t get a lot of changes in the form of comments, you can even set the cache period for a longer time to further reduce CPU usage.

      If Hostgator is willing to give you a chance to reduce your usage, I would definitely set up WP-Cache on all your blogs and see if the reduction is sufficiet for you to continue using your current account. If not, then you can always move on to bigger hosting plans. Before you move on to dedicated hosting, it might be worth it to first try out a VPS (Virtual Private Server) account. It gives you many of the benefits of dedicated servers at a much reduced cost.

      Hope this helps, and do drop by and let me know how your problem is finally solved. This kind of discussion is increasingly useful to a lot of people, and I am interested in knowing how things turn out.

      Best of luck and hope to see more of you on this site.


Trackbacks
  1. WordPress CPU Usage and the July 2007 Report Samir Bharadwaj dot Com | Shed Kits

Leave a Reply

Your email address will not be published. Required fields are marked *