Currently, even if the site is disabled, cron still runs for that site, which can be serious overhead on small servers with ~1 GB RAM and ~35 sites, some we heavy distros, like Tattler or Open Atrium etc.

This goes even worse, because there is no way to configure how many sites gets invoked cron - it defaults to 5 per run, while should be also configurable, like it is for drush tasks.

Comments

omega8cc’s picture

[edit] "some with heavy distros"

Anonymous’s picture

edit: bah, ignore this comment.

Anonymous’s picture

This is odd, how are you tracing that cron is being called on a disabled site? So I can try and reproduce

The query is from hosting_cron_get_sites() and the query is this:

db_query("SELECT n.nid FROM {node} n LEFT JOIN {hosting_site} s ON n.nid=s.nid WHERE n.type='site' and s.status = %d ORDER BY s.last_cron ASC, n.nid ASC limit %d", HOSTING_SITE_ENABLED, $limit);

So I'm having trouble finding how it could include a disabled site, unless somehow the disabled site's status has not been changed in the db.. but then it wouldn't appear as 'disabled' in the frontend if this was the case.

When I disable a site, I see the number of sites in the 'Frequency' drop as expected.

omega8cc’s picture

I noticed that after I disabled most of test sites (with easy to remember subdomains) but then, when crons were invoked, I observed a little too high server load and just checked ps axf to see what is it and found all disabled sites running cron, while these sites are visible as "disabled". I don't suppose I have Aegir db messed enough to get such results, since everything works as expected otherwise.

Anonymous’s picture

Hmm I can't reproduce this on HEAD. I'm running a 'watch -n1 "ps axf | grep php"' and when cron comes around (in my case, i've the queue running 'once per second'), only Enabled sites are being executed. Disabled sites (status = '-1' in the database) are not being run.

I'll try and reproduce on 0.4alpha2.

omega8cc’s picture

Another odd behavior I noticed: even if cron is set to run every hour (for sites) it runs anyway.

And now something really odd: this screen http://skitch.com/omega8cc/ndcbi/fullscreen says the cron was run 10 minutes ago, while the site displays info about cron last run 1 day 1 hour ago: http://skitch.com/omega8cc/ndcny/fullscreen

Anonymous’s picture

omega8cc is this on 0.4alpha2 ? Or are you running 0.3 still? I'm not reproducing this.

omega8cc’s picture

@mig5

This is running on @anarcat git, but with master/master.
An this is an upgrade from 0.3 (not fresh install)
Should I try it with just cvs head, maybe?
Will try to debug this better.

Thanks

omega8cc’s picture

Anyway, why not to allow "Items per run: 5" to be configurable?

It doesn't help at all when I can only set "Frequency", since to avoid high loads from cron running on Tattler and other heavy RSS sites, I need to be able to set how many simultaneous crons will run, so I can set "Frequency" to 3 minutes and "Items per run" to 1 (one) because I don't want to increase httpd/PHP and MySQL limits (timeouts etc) only to avoid frozen cron on some sites, because it makes entire system open to DoS attacks.

omega8cc’s picture

Status: Active » Fixed

Now I also can't reproduce this. Consider as auto-magically fixed and closed.

anarcat’s picture

See #366387: cronjob queue not aggressive enough for the tasks per run settings and other...

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.