Apache Getting Bogged Down By Certain Script (Wp-Cron.php) - How To Kill Process Automatically

Posted by user50037 on Server Fault See other posts from Server Fault or by user50037
Published on 2010-08-03T06:08:01Z Indexed on 2011/11/23 17:53 UTC
Read the original article Hit count: 197

Filed under:
|

I have a server that is running a number of wordpress blogs, and a number of them have several hundred/thousand posts.

Every couple of days, the server slows to a crawl due to a file being run on Wordpress called WP-cron.php. My entire apache process log turns into this :

http:// imgur.com/A7K9k.png

Times that by quite a bit. And server no go.

Each process takes up about 1.1% of ram. And when we have 50 of them on the go. It gets insane. Not all of them are coming from the same blog, they are pretty widespread. In the Apache process page of WHM, they are usually ALL set to the status of "C", which means closing. But they can sit there until they crash the server, and they still hold the memory.

Just google "wp-cron.php load" and you will find plenty of people with similar issues.

In anycase, we have think it is down to users adding a tonne of dead "pinglists" to their wordpress installation. Which in turn wordpress loops through them endlessly.

Problem number 1. Does anyone have any other suggestions about what would cause the Wordpress file wp-cron.php to loop endlessly. I still think it is down to pings, because all of the people we have contacted about their account load going sky high, have had massive ping lists.

Problem number 2. Even if it is down to excessive pinglists in wordpress. We cannot be babying every single account on the server waiting for it to start spawning the wp-cron processes. It often happens overnight, and I start getting SMS alerts at 2am about the load.

I have CSF installed, which apparently would have ended the processes if they ran over XXX time. But I have been told that it won't catch the processes because they end up in this state of "closing" (They show up as "C" on the Apache page of WHM). Apparently CSF will only kill processes that are "running" which C does not count.

I have seen various other scripts such as : http://dltj.org/article/die-apache-die/ . I took a look at the stat of /proc. But I was boggled at which delimited part was the time running. And if there was any way I could connect it back to an actual Apache process, so that I could see what file was running (So only close connections connected to wp-cron.php, with a state of "C").

Overall I know Problem 2 glosses over the real reason. But I do put the whole thing to excessive pinglists in Wordpress. But I just cannot sit there and babysit every single installation 24/7. So I need a way to save the server when I am not available.

Any help would be much appreciated.

© Server Fault or respective owner

Related posts about apache2

Related posts about Wordpress