Hostgator Disabled wp-cron.php Because of CPU Usage

I think it’s safe to say my blog is officially going through growing pains!  Earlier this morning I had a chat session with Hostgator because I kept receiving database errors when I was checking on my site.  I felt like I was having Déjà vu since it was only a couple weeks ago that I had slow WordPress database issues.

I never expected the amount of traffic this blog receives to grow so rapidly, last month there were 10 times the number of visits I received back in January of this year.

2011 Web Traffic

 

 

 

 

 

 

 

 

 

 

 

 

Ironically Hostgator’s support department found that the reason my server was so slow was due to one of the WordPress scripts on my site, wp-cron.php.  Below is an excerpt of the email I received from HostGator.

 

Subject: Ticket [QCQ-15945XXX]: TOS/CPU
Reply-To: 15945XXX@tickets.hostgator.com

Hello, 

Unfortunately, we were forced to suspend the script "/home/<username>/public_html/samkear.com/wp-cron.php" as it was causing a high load on the server, and due to this affecting all of the other accounts on the system, we were forced to take immediate action for the health of the server. 

This particular script is used for certain wordpress tasks, such as trackbacks, link checks, and autoposting plug-ins. If you have a large volume of articles, we recommend that you disable this, or disable this on any particularly popular popular articles that you may have. Please let us know how you would like to proceed. 

Best Regards,
SteveC
Linux Systems Administrator
HostGator.com LLC
http://support.hostgator.com

In the message they said they were forced to suspend the script.  As you can see below HostGator removed all permissions on the wp-cron.php file preventing all access to it.




I did some research on wp-cron and apparently the php script is called on every single page load!  To me this seems to be out right ridiculous, why would WordPress implement such a sloppy function call?

HostGator’s suggestion to disable wp-cron all together was starting to sound pretty good.

I stumpled on a post on buildyourblog.net that was made just a few days ago that explains how to disable wp-cron.

Following Graham’s instructions I edited wp-config.php using the editor in cpanel to disable wp-cron.  I then setup a cron job to run wp-cron.php twice a day.  I let host gator know of the changes I implemented so hopefully they will restore permissions to the file soon.

This change should make a big impact on the overall performance of the site since wp-cron won’t have to run hundreds of times daily.  The WordPress authors really need to look into changing the cron functionality in WordPress.

 

 

Sam Kear

Sam graduated from the University of Missouri - Kansas City with a bachelors degree in Information Technology. Currently he works as a network analyst for an algorithmic trading firm. Sam enjoys the challenge of troubleshooting complex problems and is constantly experimenting with new technologies.

4 thoughts to “Hostgator Disabled wp-cron.php Because of CPU Usage”

  1. Thanks for your post on this. I’m just starting to research a similar problem with a Drupal site. But it doesn’t have a high traffic problem, so I’m baffled (so far).

    1. I have an answer from Hostgator now… they said my cron script was running every 2 minutes! I thought I had it set to every hour, but apparently I messed up (they only allow them to run every 15 minutes, I believe). But they were courteous and fixed it for me. I guess it pays to double check every once in a while because it’s been like that for way over a year 🙂

Leave a Reply

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