Disclaimer Try the below things to your WordPress site At Your Own Risk, make sure you take a backup of your database before beginning anything that makes changes.
Update December 28, 2010
Ok this will be the last update to this issue unless I discover anymore possible fixes that may help. First off here is something I did that may not be an option for everyone. I replaced my under performing server with a much better one, I went from a nearly 10 year old single core Anathlon server with only a gig ram to a Quad Core Xeon server with 2 gig ram. Now this did make some improvements but surprise-surprise (note sarcasm here) … It oveerloaded after a short time now I really knew it was not a matter of server power. Granted the site in question has grown in traffic from 1 to 2k visitors per day so traffic and page views hass doubled so that was some effect but not all.
Ok so what did I do next, well I changed out the site theme to a higher quality better coded theme this made a world of difference in site speed and overloading slowed down alllot. I also did one other thing that goes against common sense here. I cleaned out and removed the caching plugins I had tried just to see what would happen andf becasue I was seeing errors in the page deliverys for some reason. After that overloading almost came to a complete halt….. This was very strange but since overloading had almost stopped I ran with it and aal seemed fine most of the time with with the occasional overload.
Now for the final thing I have done and this one is interesting I discovered it while doing research for one of my plug-in podcasts on a completely unrelated plug-in. I discovered some memoery montering plugins for WordPress and though I know most of what is overloading is due to memory issues so let me load them up and see. The plug-ins are listed below. After loading them up I discoveered that the main site I was working on was using 33.8mg ram and WordPress had a limit of 32 and php had a limit of 64. Well first I increased the limit for PHP to 128 and this had no effect I did have to do a little research for increasing the memory limit for WP from the default of 32m. To do this simply add the following line of code to your wp-config.php file somewhere near the top.
/** Increase the default memory limit for WordPress */
Suddenly the site was very fast and loading seems to have been eliminated if it comes back I will make note heere of anything new I try.
Questions please feel free to leave a comment here or contact me though the contact page for additional help with this issue. Also you come up with any tips for me on this issue please let me know about them I would appreciate it thanks.
Update to this November 30, 2010
Ok it has been a couple days now and the loading has not returned for the sites that I did the fix on the cron jobs. Here is my suppositions on what has happened. The sites affected by this issue had addition plug-ins added that added new cron jobs to the cue. Now to test the theory that the cron jobs where locking up and then suddenly dumping what I did was remove the extra cron jobs leaving the ones set by WordPress.
Now even if I removed those default cron jobs they came back automatically reinstalled. Now the server still loaded on those account so I though hmmm maybe it is an issue with the crons supplied by WordPress that is the crons that check several times a day for plug-in, theme, and core updates. Now I thought does this really need to be checked this often.
So what I did was download and install the plug-in “Disable WordPress Updates” for disabling those processes and checked to see if the cron job was gone. It was now, so the only cron jobs there are ones I put in or none at all. Well without those extra cron jobs the sites do not seem to be loading up anymore. I will watch for several more days and let you know if it stays this way.
Hope this helps someone else out there save hours of anguish that I went though.
Update to this November 29, 2010, well what I tried below did not work for very long only about 5 hours then it was all back again. So back into it I went. I discovered something else about the wp-cron.php system. What I discovered is that often time’s jobs will get stuck in the cron system and cause multiple spawns so here is what you need to do.
First, you will need access to your database though something like phpMyadmin. Go to your data base and find the table labeled options, then find the line labeled cron. You will see several lines of text not very understandable, each line is a cron job to be done. Look at it if there seems to be many jobs there then install this plug-in “Cron View” then look and see what those jobs are.
Now here is where it get tricky, do not start editing this unless you are comfortable with possibly making a mistake and causing things to break. Needless to say make sure you have a backup of your database before you start messing with it.
Now edit this line and copy all the text from the box paste it into a text window to edit it. Open the window so that the lines do not loop. Each line corresponds to the list you have in Cron View, now delete the ones you think are bad, if you don’t know you can always ask here I will try to answer if I can.
Original November 28, 2010 Have you received the dreaded suspension notice for excessive resource usage, or notices of excessive resource usage for your WordPress website? If you have hopefully this post will help you solve the root issue causing the problem.
Welcome to WordPress probably the best CMS system ever developed and one of the most intuitive systems to use. I have a friend of mine who has very little web knowledge and she has figured it out in only a week and is now creating themes for it. Granted she is using Artisteer to create those themes but still it is a start.
So anyway, the reason for this post is that there is a problem that occurs with WordPress when it suddenly starts spawning numerous index.php files and loading up the server. I am fortunate in that I run my own servers otherwise I would have been shut down several times by now. Why? For excessive CPU usage of course! I have been fighting this problem for months and barely been able to keep ahead of it.
Here is the scenario, I had no problems on my several sites for many months but they had very little traffic only about 20 to 50 visitors per day a hundred or so page views so everything went along just fine I did not know the Demon I was about to unleash. First, I started by picking a couple choice niche blogs of mine and installing WP-Robot the auto content posting system on them. Then I spent some time promoting them to numerous websites and directories to bring in the traffic. The Demon suddenly arose about the time the first site started hitting 200+ unique visitors per day and at about 1000 page views per day.
So why is this a problem that seems to suddenly start to load up your server? Well it has to do with the way wp-cron.php is called and used. You see the wp-cron.php file is there to do all the odd jobs you have on you blog in my case it runs the WP-Robot scheduled tasks, the comments, the email lists, ping backs and on and on with the tasks. Now what happens is that every time a page is loaded by a user/visitor to your site the wp-cron.php is called, I REPEAT that is every time a page is loaded it calls the wp-cron.php file. Now on one of my busier sites that I have been fighting this issue on, the website is now seeing 1200+ visitors per day with over 5000 pages per day loaded. Now that is an average of 4 pages per minute, sometimes it will be a couple dozen pages all at once which is when the server loads up.
So what do you do about this? Well here are the things that I have tried with limited success. You may not be able to do many of these unless you have your own server.
- Changed my apache settings to better control for memory — need you own server or root access to make these changes.
- Changed my php settings from running as a cgi — not recommended doing this causes all kinds of permissions grief and I had to change back — this did a great job of solving the loading issue but had other problems that I would not settle for.
- Was tempted to setup a script to kill and restart apache every time the system loaded up, but as I read somewhere it is not a solution to “Put a bullet in Apache's head every time it misbehaves” this would only be a symptom fix not solve the underlying issue.
- The one thing that seems universal in all this is that the wp-cron.php is the culprit 90% of the time. Hopefully one day the WordPress team will start to address this issue, as you will see in many of the suggested sites the complaints go bac for 3+ years for the same problem.
- I have added different types of caching plug-ins but they only solved the issue until the sites became busier. Seemed every time I thought I solved the problem it would only last until the site became busier.
- I spent allot time in the forums and different websites for answers, seems this is a rampant problem but no real solutions have arisen yet. At the bottom of this post is a list of some sites that have provided hints on what to do.
Today I tried a solution that seems to be helping I will update this after a couple of days to let you know. Here is that solution as provided by a user on the WP forums at http://wordpress.org/support/topic/more-wp-cronphp-and-cronphp-woes-server-overload The solution is to add some code to your cron.php file located in the /includes/ folder. The full path will be wordpresslocaction/includes/cron.php this will vary depending on if your WordPress install is in your root or a subdirectory.
Now add the following code just below the function wp_cron(): you will find this at about line 244 add this code:
// Prevent spawning cron if it's already active:
if ( get_option(‘doing_cron') > time() )
What this guy talks about is that the cron starts when another is already running and this stops it from doing that. Hopefully this works I will know in the next 24hours since it does not take long to find out when a solution does not work.
List of sites with some suggested solutions:
As an aside here is a great article on WordPress SEO by Yoast.