Very High CPU Usage
-
Hello,
Long time reader, first time poster.
I have a problem with my WordPress installation. I even got banned from shared hosting for this and put my own server and still have this problem. Apache has a very high CPU usage (it makes 100% of 1-3 processes) on a 1.5GHz box every time I get a dynamic request on the server.
My DB is 30MB and have about 4000 pages (articles + pages) on the website.
Without cache the site works really bad (I use wp-super-cache).
I tried updating WordPress (I’m on 2.3.3. now. 2.5 blocks my server completely with a single process using 100% CPU and the older version (2.0.x, etc) work in a similar bad way), disabling all the plugins, enabling cache but didn’t find a way to get decent CPU usage from Apache (MySQL works OK. Apache is the problem).
I use now an Ubuntu Server with LAMP chosen at install. The old hosting (which banned me for exceeding CPU quota) was GoDaddy. Also I should mention that accessing the permalinks page (in options) takes 30-100 seconds, time in which the CPU stays at 100%.
Thanks.
-
recetas de postres, sorry you are having this problem. What is happening now? Site looks good.
Here is My Low-Traffic, Low Post-Count (700), CPU Top-Level Usage Spike Story.
I got the notice from LunarPages exactly one week ago. Or should I say I got zero notice, the WP site just went down, with a placeholder page saying I had to contact them.
I was informed they were moving the site to a stabilization server, and gave me two weeks to figure out and solve the problem myself. This was the first of many boilerplate messages about how they could not support the high CPU usage and keep me on a shared server, and maybe I should consider moving to the Giant Greasy Cheese and Chicken Wings of Platinum Elite Dedicated Service for $99/month. Or whatever, the next option up from $7.95 a month was $39.99. Why?
Thus began daily reports of CPU readings, and my earnest juggling of old and new plug-ins, and practices.
I asked three times for a basic explanation of what the daily numbers meant. Finally got a real response, but from start to finish, they gave me exactly NO HELP AT ALL: routinely ignored further questions, capped every report with “you must upgrade,” and, each and every time — this is 36 or so messages — the closing: If you have any more questions, please don’t hesitate to ask us, we will be happy to answer them. Please feel free to contact us for further help. Kind Regards….
What earth-shaking curse would an old-testament prophet have uttered? I want to know those words, I want to say those words to LunarPages. I want to send them all — board member and intern, stockholder and extended family, pets — to perdition, with a mighty, sweeping, robed gesture.
Ahem. So, not knowing much of anything, I pored through these forum pages, reading anything having to do with CPU top-level spikes, the nightmare stories, the ceremonial trashing of different hosting providers.
But, if you looked in one week ago, or seven months ago, or dare I say seven months from now (check the date), there is no single answer or fix to the CPU spike issue. I am sure the silent, suffering majority of readers of this forum will have to surmise as much at some point. It could well be a confluence of factors: attacks, WP weakness, database vulnerabilities, who knows!
I did emerge from this experience after one week, with several important and practical bits of understanding:
1. PREVENTIVE MAINTENANCE. See BernardBorealis’ helpful checklist.
2. WHATEVER ITS CAUSES, IT SEEMS TO BE A REAL RACKET. CPU usage spikes are apparently the bread and butter of cheap, oversold, under-serviced shared hosting plans. (Ever bought a new philips-head screwdriver for a quarter? They work great if you never use them.)
2.1 If your hosting support people make it clear that it’s YOUR PROBLEM to solve, pressuring you to switch to a higher-cost plan, and your site has 700 pages, 9 comments, and 56 hits in a week, take it calmly, be adult about it. Say or do whatever is needed to keep your site accessible for a week or two so you can get it the hell out of there.
2.2 If you have just signed on for four years of “service” at $4.95 per month, prepaid, accept it philosophically. Oh, and kiss that money goodbye. Maybe you can deduct it as an educational expense. It is, in fact, an education that you have paid for.
3. THE WORSE CASE SCENARIO IS NOT SO BAD. Go directly to How to Move WordPress. Learn how to export your database, see what it takes to get your show on the road.
4. GO SHOPPING. My last 12 months of hosting experience is limited to Midphase (awful, too many outages, company is too big) LunarPages (reasons given), so I can’t say this is the best out there, but I went with TigerTech on the advice of a friend who is a developer and works with them a lot.
4.1 With them you can pay monthly, or annually. You can shell out $6 or $7 for a month, new domain name included, and you’ll have a much better grasp of what you are doing by the end of the installation ordeal, even if you want to then go to another service. (Choose domain name wisely, in case you do ditch.)
4.2 On their contact page they actually have an inquiry category “Question from a potential customer.” What? I received an explanation about my CPU spikes being very momentary, according to the LunarPages reports, and not an all-day gasket-blowing fire-hazard. And some clear, uncomplicated warnings about WP plug-ins being unpredictable, and a bit about hwo they don’t penalize for CPU spikage, etc. That was yesterday. I signed up yesterday. I moved the site today. No cpanel, no Fantastico. Now it all seems so long ago that I needed those things. My posture has even improved… a little.
Disclaimer: TigerTech may well get bought by sharks and turned into profitable, high-fructose crap-on-a-stick, like so many other firms. You never know. Anyway, I have only today’s proof of my colleague’s recommendation, and the night-and-day comparison with LunarPages’ utterly awful, life-defying anti-support. (I curse the very bones of their ancestors to HELL!)
It’s a basic issue: You should be able to ask a potential hosting company (one you don’t have an account with, that is), “What about these unexplainable CPU usage spikes” and get a comprehensible and satisfactory answer.
Hi dgllc – No, my problem has not been solved yet. I am now 95% sure this is a bug within wordpress somewhere, as I have read tons of these complaints, and no definite fix anywhere.
I have disabled ALL of my plugins, repaired and optimized database and reverted to the default theme. With 1000 unique visits a day, I can’t figure out what is going on.
Im still unable to resolve this problem. I recently upgraded to a quadcore server and just left the wp-options at over 40mbs and my site seems to run smoothly. It seems that the problem occurs when you create or edit a “page” or upload images to that old or new page. Hopefully a upgrade to wp 2.7 will solve this. will update.
dgllc, great post. Made me feel better. My host is exactly the same. They have copy and paste replies preprepared. It is the most frustrating experience to deal with them. One redeeming feature they have is that they are $36 a year. Anyway,
I am in the same position.
I have been told by my host that my blog has just started overloading their server’s CPU and the account gets closed. I ask them to open it again for me but it overloads in a few hours and gets shut down again. I need to find out the cause and resolve it.
I have read a lot and many people are saying that WP Super Cache is the way to resolve this.
Another recent poster concluded after all the digging he did it turns out that the WP Super Cache plug in was actually the CAUSE of his problem.
Then there was something about cron…
…but I don’t know much about how to carry out most of what people are talking about, where to go or what to do in PHPMyAdmin. Worse still, I don’t have much time left, I doubt the host will continue to reset the account only to have my blog potentially overload their server’s CPU again.
Any help would be appreciated if anyone has any more info to add.
Thanks.
I have managed to get my host to put my site back up online again so that I can access what the cause of this frustrating issue is. The problem is I have no idea at all what I am doing in PHPMyAdmin. Many of the things mentioned in this string are difficult to comprehend, I really need a step by step set of instructions as I can’t even find the options that people are referring to.
Here are some questions I have about things mentioned in this long string which I have read several times now:
I have no idea what caused this problem to start occurring. I have not upgraded recently. The only thing I can think of is I altered the permalinks of a few posts that had long links. I didn’t think this was a problem as WP gives you the option to edit them. But I can’t think what else I have changed to create this problem.
I am currently running version 2.7.0.Will upgrading to 2.7.1 perhaps fix this problem?
+++++
I tried Otto’s suggestion of putting this in the wp-config.php file:
Put this in wp-config.php:?define(‘SAVEQUERIES’, true);
and this in the footer:
<?php if ( current_user_can(‘manage_options’) ) {
echo “<!–\n”;
var_dump($wpdb->queries);
echo “\n–>”;
} ?>But it made no difference, I couldn’t see any change on any of the blog’s pages when logged in with admin rights. Is it because I removed the Administrator user? Or can anyone with admin rights do this? Perhaps this only refers to an earlier version of WP?
++++
Otto also suggests the following:
“Might try going to the settings->Permalinks page and updating them. That should force it to regenerate the rewrite rules, might clean out some of the crap if there is any.”
But I see no way of resetting the permalinks at this page. I can change the setting to another setting (i.e., from custom to default) is that what is meant by “resetting”?
Again, “reset” feature is no longer present in 2.7?
+++
The WP_options table. I don’t feel at all comfortable in phpMyAdmin and hesitate to tweak anything in there. There were several mentions in this string and elsewhere about looking at the size of the “rewrite_rules” but again, I see nothing like that in my wp-options table. I have gone through each tab (Browse, Structure, SQL, Search, etc) but can’t find anything relating to “rewrite_rules”.
Where do I find these?
The Space usage of the data in my WP-Options table is 703 KB but the Overhead is 30KB. Doesn’t sound like much, is this a problem> Should there be any overhead at all or is some ok?
Should I click on “Optimize table”
+++
Is there any way of testing to see if any changes I make will be effective? I mean, short of my account being banned and shut down again (always a strong indicator that the problem remains) is there a tool that I can use to monitor the system so that I can see what changes are effective?
Or are you people who are talking about CPU figures running your own internal server?
Any help at all on any of these questions would be greatly appreciated.
Dave, be real careful with your database. Before you go poking around while not knowing anything about it, make sure you back up your database. I have a video on my site on how to do this.
Second, don’t click on the Optimize Table. I did it once and it crashed my blog. Only do that if you know what you’re doing.
If your host is saying you’re site is overdoing your alloted CPU usage quota, that could mean a few things. It could mean a ton of people have come to your site all at once and are clicking around.
You might not go over your alloted bandwidth, but remember, each time someone clicks something on your “WordPress” site, there are calls to the database. In order to do anything, the server’s CPU must be called.
Most hosts only allow your website so much CPU time. If you go over, they lock you out. One of our customers had the exact same problem. She hosted with BlueHost and they only allowed her 4% cpu time. The problem was, she got a decent amount of traffic to her site in single shots, so her blog overworked the server’s CPU (you can read her issue on our customer’s testimonial page).
If you’re having issues with CPU time, you really only have a couple choices.
- Upgrade to a Virtual/Dedicated server
- Move to another host with less CPU restriction
You can try Super-Cache, that might help, but it might not..?
Good luck.
JohnOK Well I tried Super-Cache.
After several reductions in security that it insisted on and code insertions into pages and the htacess file I now have a blank white page instead of a blog.
My site is still up, granted. But its a blank white page. Not so good.
I have no idea why but if I log in then I can view my blog no problem.
Log back out and visit the site – blank white page again.
Anyone know whats going on here?
Thanks.
Undo whatever changes you did and deactivate the plugin. That should at least bring you to square one.
I recently received warning from LunarPages that I was consuming too many resources on the shared server, which is odd because I have been running basically the same setup for months now.
I did recently upgrade to 2.7.1, but that was weeks before this issue came up. I’ve already disabled or downgraded any plugins recently added or upgraded.
Totally baffled by this and the geek level is over my head on this stuff. It has to be either a plugin or I am getting bots attacking. I have a bunch of security plugins for the comments, contact form, etc. Most of those have been running for months with no issue. Maybe they just never got attacked before?
Running the K2 theme with very minimal customization.
Here’s the site in case anyone wants to have a look. And it hasn’t been taken offline again for CPU hogging ??
Hi George, your situation sounds the same as mine. I had the blog taking my whole account down (which has several other sites on it) several times. Each time I had to ask the host to reset the account only to have it overload thier server’s CPU again and have the plug pulled again. I was unable to get this super cache plug in to work as the instructions contradicted themselves – instructions on the site differ from those in the readme file, so I uninstalled and removed it.
I thought this super cache might be the answer to my problems. Now I have more problems and an open and vulnerable system due to all the reductions in security that this plug insists on you making in order to run.
Stupidly, I didn’t make a record of all the security reductions that had to be made, I really didn’t think there would be so many and thought I’d be able to remember them. Big mistake.
I’ve disabled the plugin and removed it but am left with these gaping holes. Does anyone know of a list of all the security changes so that I can go back and patch them all up again?
Meanwhile, unrelated to this plugin (as I never sucessfully got it to instal), my blog is no longer overloading the server CPU.
No idea what the cause was but it’s gone now.
@dave333 – Yeah I looked into those plugins and they looked a bit scary. Plus, I know my blog isn’t getting Digg-level hits or anything so I am not sure that would help.
LunarPages suggested a bot attack from perhaps Comments or a contact form, but I have been running fine with a bunch of comment/login security plugins for years (Askimet, Bad Behavior, Email Obfuscator, Enhanced WP-ContactForm, Login LockDown, Register Plus, Subscribe2).
My next course of action is to re-install all my essential plugins, maybe some bad code crept in there or something. Webhost support is no help at all, all I am told it that it’s my index page. Why they can’t look into it deeper is beyond me, but I guess you get what you pay for.
- The topic ‘Very High CPU Usage’ is closed to new replies.