Web Hosting Forum | Lunarpages


*
Welcome, Guest. Please login or register.
Did you miss your activation email?



Login with username, password and session length
February 09, 2012, 08:06:01 PM

Pages: [1]   Go Down
  Print  
Author Topic: Wordpress Blog Causing Heavy CPU Usage Problems  (Read 1126 times)
tacitus
Pong! (the videogame) Master
*****
Offline Offline

Posts: 29


« on: February 21, 2010, 09:34:05 PM »

Hi,

I have been a very happy customer of LunarPages for several years, but for the first time last week I got the dreaded email from support saying that they had to rename one of my scripts because it was using too many CPU resources.

Well, when I looked, the "script" was the index.php file for WordPress -- i.e. they had taken the whole blog down.  From reading the forum, I can see that they can't pinpoint which PHP file is causing the problem (is that still true?) so it's no surprise that they had to disable the main entry point for the whole of Wordpress.

What's very puzzling though is that the WordPress installation had not been modified or changed in any way (except for new blog posts a couple of times a week) for months and had, I assumed, been running with no problems. The blog only gets about 30-40 visits a day, and about 100 page views, so it's not heavily used blog.  I have checked through the installation and all the available states and logs, and have found nothing to indicate that it have been attacked or hacked in any way, so I am left with the assumption that something caused something in WordPress to start misbehaving all of a sudden.

I am working with support on this problem, but I was wondering if anyone has had similar issues with their WordPress blogs on LP, and if they found a solution.  The installation was out of date -- WP 2.5 -- but since there had not been any issues up till last week, I don't see how that would be a problem.  I have upgraded to WP 2.9.2 which is the very latest version, and upgraded all the plugins too.  I have also updated my sitemap.xml, added a much better robots.xml, and disabled hotlinking, though there was no evidence that any of these was causing a problem.

I also have a general question about CPU usage.  In LP support's last reply, they listed three incidents of high CPU usage.  The first one I could tell occurred when I told Wordpress to upgrade about a dozen different plugins all at once on one of my blogs (not the one that was disabled).  It took about a minute to complete, and it seems it caused a peak load of 93%.  I understand that's very high, but it was a one-off activity on a blog that has not been active at all -- no readers, no posts -- for months.  

So my question Is something like that likely to get me into trouble on its own, or does it have to be a pattern of high CPU usage over a period of, say 10 minutes, 30 minutes, or an hour, or something?  (In this case, I could probably have avoided the spike by upgrading the plugins one at a time, but I would like to know if that's necessary or not.)

I fully understand that on a shared system, CPU cycles must be kept under control, but with a large script installation like Wordpress, you are sometimes at the mercy of the WP developers, and more likely the WP plugin developers, and since a blog with only a few dozen readers a day (at most) should not be causing a heavy load on the LP servers, I am looking for any guidance anyone can give to help avoid this situation in the future.

Cheers,

Mike

P.S. I should add that I appreciate LP Support's perseverance on this matter, and the fact that they didn't just suspend my account completely because of the problems.  I will continue to work with them to find a solution to the problem.
Logged
Mitch
Berserker Poster
*****
Offline Offline

Posts: 12838


WWW
« Reply #1 on: February 22, 2010, 05:09:53 AM »

Well, I trust you are in good hands with our server admins - as they help you troubleshoot this, however one line of your story stuck out for me:

Quote
The installation was out of date -- WP 2.5 -- but since there had not been any issues up till last week, I don't see how that would be a problem.

Not using the latest and greatest version of any script is going to cause you problems.  Just like you need to keep your personal computer updated when new security patches and fixes come out, the same could be said for the scripts you have installed on your web hosting account.  You can take a look here to read some of the release notes that have come out between your version of WP you had and the latest version to see how many security holes have been fixed:

http://wordpress.org/development/category/releases/

I'm not sure if that is the exact situation with your web hosting account/resource usage problem, but might be worth looking into.  Hope that helps!
Logged

New to Web Site Hosting? Check Out the Lunarpages Blog Hosting Guide!


Follow us @lunarpages on Twitter!
Important Threads: Read This Before Posting! | Lunarforums Rules! | Mitch's Link of the Day!
Also, be sure to check out and subscribe to the Lunartics Blog and the Lunarpages Newsletter !

Need Web Hosting Help? Check out the Lunarpages Web Hosting Wiki. It has tons of tips, tutorials and resources!
scanman20
Über Jedi
*****
Offline Offline

Posts: 1520



WWW
« Reply #2 on: February 22, 2010, 06:15:51 AM »

I highly recommend using the WP cache plugin. It's excellent at reducing the load on the server.
Logged

Even a broken clock is right twice a day.
NotOneBit.com
MCSE - MCSA - MCP
tacitus
Pong! (the videogame) Master
*****
Offline Offline

Posts: 29


« Reply #3 on: February 22, 2010, 09:31:10 AM »

Thanks for the replies, guys.

Re: old WP versions -- yes, I agree.  There is certainly a risk of leaving yourself open to exploits by staying on old releases, and I was remiss for not keeping up with the latest versions.  In this case though, it seems likely that there was no security breach since there was no evidence of tampering or hacking.

I do have WP-Cache installed on all my blogs, I think, though given that the time between visits is measured in minutes, not seconds, I doubt it makes much difference.

Anyway, if I find out what the problem is (if it doesn't just go away on upgrade) then I will post the details.
Logged
MrPhil
Berserker Poster
*****
Offline Offline

Posts: 5083



« Reply #4 on: February 22, 2010, 01:29:47 PM »

it seems likely that there was no security breach since there was no evidence of tampering or hacking.

Did you thoroughly go through your site before making that statement? Have you at least looked at the "last modified" date on all your files, and accounted for any new files? Just because your blog didn't go belly up, or engage in any other obviously bad behavior, doesn't mean it isn't being exploited to do something nasty (spamming, DDoS attacks, etc.). It could well be your plug-in update that's the culprit, but more often than not, it's because a site has been hacked, especially if it's quite back-level. Just because it's still functioning at its original purpose doesn't mean it's not doing other things now...
Logged

tacitus
Pong! (the videogame) Master
*****
Offline Offline

Posts: 29


« Reply #5 on: February 23, 2010, 12:26:34 AM »

You have a point.  It's not that easy to find the modification dates via CPanel, but I guess I could use an FTP client.  Of course, now that I've fiddled with lots of things, it will be harder to detect.

The latest report is better, but still not good enough.  So I have trimmed down the content on the page -- removed several mostly superfluous widgets and plugins from the rendering path, to see what sort of effect that might have.  I've also slammed the door on one obvious (attempted) exploit.  The blog's Guestbook was being hammered by comment spam, but since the last person to add a real comment to the guestbook was seven months ago (it's not a busy blog) then I have simply disabled comments on that page for now.  Closing comments on old blog posts also reduces the number of spamming targets considerably.

Anyway, I shall ask for another usage report tomorrow and will see if these actions help at all.  If not, then some close inspection of the code may be in order (yuck!).
Logged
MrPhil
Berserker Poster
*****
Offline Offline

Posts: 5083



« Reply #6 on: February 23, 2010, 07:29:14 AM »

You have a point.  It's not that easy to find the modification dates via CPanel, but I guess I could use an FTP client.

If you don't have command line access (SSH), run a one-time cron job: ls -alR . This will list all your files along with sizes and last-modified dates. I run this on a regular basis, comparing the current listing with the previous to see what's changed (and investigating any unexpected changes). You can limit it to the site itself with ls -alR public_html .
Logged

tacitus
Pong! (the videogame) Master
*****
Offline Offline

Posts: 29


« Reply #7 on: February 23, 2010, 01:35:21 PM »

Thank you very much for that tip!
Logged
Pages: [1]   Go Up
  Print  
 
Jump to: