• mrarrow

    (@mrarrow)


    I run my own VPS (Apache 2.0.63, PHP 5, MySQL 5.091) and have quite a few multisite installs for various clients.

    One of these installs however regularly (twice a week?) generates the following warnings that get sent to me. At this point the server grinds to a halt for a couple of minutes until the processes clear.

    I’ve read in quite a few places that wp-cron.php can actually cause this problem but wondered whether anyone had a solution for it? The customer is using The Morning After theme which in itself doesn’t seem to be doing anything unusual. Any ideas or thoughts?

    Time:          Mon Nov 22 19:08:31 2010 +0000
    Account:       <nameofuser>
    Process Count: 11 (Not killed)
    
    Process Information:
    
    User:<nameofuser> PID:1520 Run Time:57(secs) Memory:170088(kb) exe:/usr/bin/php cmd:/usr/bin/php /home/<nameofuser>/public_html/wp-cron.php
    User:<nameofuser> PID:1708 Run Time:50(secs) Memory:171648(kb) exe:/usr/bin/php cmd:/usr/bin/php /home/<nameofuser>/public_html/index.php
    User:<nameofuser> PID:3435 Run Time:37(secs) Memory:169832(kb) exe:/usr/bin/php cmd:/usr/bin/php /home/<nameofuser>/public_html/index.php
    User:<nameofuser> PID:3476 Run Time:36(secs) Memory:160624(kb) exe:/usr/bin/php cmd:/usr/bin/php /home/<nameofuser>/public_html/index.php
    User:<nameofuser> PID:3547 Run Time:33(secs) Memory:160880(kb) exe:/usr/bin/php cmd:/usr/bin/php /home/<nameofuser>/public_html/index.php
    User:<nameofuser> PID:20399 Run Time:17(secs) Memory:147880(kb) exe:/usr/bin/php cmd:/usr/bin/php /home/<nameofuser>/public_html/index.php
    User:<nameofuser> PID:20462 Run Time:15(secs) Memory:160344(kb) exe:/usr/bin/php cmd:/usr/bin/php /home/<nameofuser>/public_html/wp-cron.php
    User:<nameofuser> PID:24550 Run Time:0(secs) Memory:147880(kb) exe:/usr/bin/php cmd:/usr/bin/php /home/<nameofuser>/public_html/wp-cron.php
    User:<nameofuser> PID:32667 Run Time:65(secs) Memory:169836(kb) exe:/usr/bin/php cmd:/usr/bin/php /home/<nameofuser>/public_html/index.php
    User:<nameofuser> PID:32694 Run Time:63(secs) Memory:172200(kb) exe:/usr/bin/php cmd:/usr/bin/php /home/<nameofuser>/public_html/index.php
    User:<nameofuser> PID:32720 Run Time:63(secs) Memory:169832(kb) exe:/usr/bin/php cmd:/usr/bin/php /home/<nameofuser>/public_html/index.php
Viewing 8 replies - 16 through 23 (of 23 total)
  • Could have been a plugin though.

    Thread Starter mrarrow

    (@mrarrow)

    Now that a suitable amount of time has elapsed, I can confirm that the following sorted my particular issues:

    Resetting my global PHP.ini file to following:
    CORE: memory_limit = 96Mb
    OPTIONS & INFORMATION: max_execution_time = 60secs

    For sites with any significant traffic, I also disabled wp-cron in the wp-config.php file and set up cron jobs in cPanel (for each site and subdomain) to run at regular intervals, generally 4-6hrs. All as detailed above.

    This then fixed the issues almost immediately.

    Further to that, I recently noticed that 1Gb of RAM had “dropped off” my VPS (should’ve had 2Gb. but it was only operating with 1Gb!!!!). So I politely requested my hosting provider find the extra RAM and reapply it…

    This actually may have been the catalyst for the problems in the first place, but clearly the first two actions fixed the server load before I noticed the missing RAM and WP leaner and meaner the first place.

    I’m currently running about 15-20 separate WP installs on the same VPS, most with multiple subdomains.

    Dang I wish we could like forum posts. ??

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    Ditto.

    Have you checked out 3.1 yet? IIRC is has some cron helpage (ONLY the main site kicks off certain jobs, iirc).

    Thread Starter mrarrow

    (@mrarrow)

    No I’ve not gone to WP 3.1 yet, as the sites that were causing me grief are all using TDO Mini Forms and from what I understand, that plugin no longer works with 3.1. Grrrr….

    However, on the other sites, I’m maintaining the installs via Subversion, so upgrading those shouldn’t be a problem, right?

    Thanks mrarrow for your cron’s adventures feedback ??

    I’m trying myself to shed some light upon missing scheduled posts in a network of 100+ blogs of a WP3 multisite installation, WP-super-cache enabled.

    I’ve pretty much followed the instructions listed here to crontab a custom wp-cron-all.php script, but authors of some blogs report that their scheduled posts doesn’t get published, dashboard reports “missing schedule”.

    wp-cron-all.php is crontabbed to run every 15 minutes.

    This file contains among other things a loop made this way:

    foreach ($blogs as $blog) {
    	$cronStartTime = microtime(true);
    
    	echo date('Y/m/d H:i:s', $cronStartTime) . " Starting wp-cron for $blog->domain"."$blog->path...";
    	$cron_url = $blog->domain . $blog->path . 'wp-cron.php?doing_wp_cron';
    	wp_remote_post( $cron_url, array('timeout' => 0.01, 'blocking' => false, 'sslverify' => false) );
    
    	$cronEndTime = microtime(true);
    	$duration = $cronEndTime - $cronStartTime;
    	echo " (completed in ". $duration ." seconds)<br />\r\n";
    }

    The log.txt that is output indicates that every call to blogXXX/wp-cron.php?doing_wp_cron is executed correctly. (I don’t know what “doing_wp_cron” is for).

    But if I run a-blog/wp.cron.php manually from a browser, it loads and loads and loads, never ends, this makes me think.

    Trying to re-enable default WP cron, removing the constant from wp-config.php, caused the server to freeze, and needed to reboot.

    I also have had some issues with many wp-cron processes running and causing CPU throttling.
    As I knew which plugin was running, rather than disabling wp-cron on wp-config.php (I am not brave enough .), I came up with a few lines of code using API_transient that make the trick.

    $prefix = .... // something to help you searching your stuff on wp_options table
    $name = ..... // whatever identifies your function
    $mins = .... // maximum frequency
    $trname = substr( $prefix . sprintf( "%u", crc32($name)), 0, 45 );
    if( get_transient($trname) )
    return "-- not yet";
    set_transient( $trname, date('c'), $mins*60 );
    // your program ....

    Hello,

    I have a server with lot of WordPress websites. I often get such notification emails.

    Few things I have experimented are:

    1. Sometimes this is caused due to plugins. So make sure to disable all plugins and then enable each one every day.
    2. If the site has lot of posts and some buggy sitemap generator plugin or some backup plugin, then this can also cause the issue.
    3. I disabled WP-Cron from the functions.php file. I then setup a CRON using the hosting’s control panel (in my case Cpanel) and setup a cron job every minute. (+1 to @mrarrow)

    For WordPress, always make sure to have a cache plugin. It reduced lot of load. Try reducing the number of queries in the themes too. It has a big impact in overall speed.

Viewing 8 replies - 16 through 23 (of 23 total)
  • The topic ‘wp-cron causing excessive processes’ is closed to new replies.