A little example:

Cron queue

* Status: enabled
* Description: Run cron on hosted sites.
* Frequency: every 1 hour
* Items per run: 5
* Items in queue: 43
* Last run: 6 min ago

We should run all sites every hour, no?

CommentFileSizeAuthor
#4 Screen shot 2009-11-05 at 9.47.41 AM.png8.61 KBadrian

Comments

anarcat’s picture

17:07:25 <@Vertice> the cron queue should be a batch queue
17:07:27 <@Vertice> not a serial queue
17:07:33 <@Vertice> ie: it should try to get all sites within 1 hour
17:07:39 <@Vertice> figuring out the frequency
17:07:43 <@Vertice> it needs to be called
17:07:45 <@Vertice> and the amount of sites
17:07:49 <@Vertice> it also has a threshold
17:08:03 <@Vertice> so the more sites you have, the more frequently it is run and the more sites it runs per cron job
anarcat’s picture

Issue tags: +aegir-0.4

Basically, I think the current design of the cron queue is wrong: we shouldn't run cron jobs in parallel unless we really have to. Also, the control should be over the frequency of the cron jobs (which could be per site) than the number of cron jobs per run. When a cron job is due, it's due, that's it, it needs to be ran. The frequency should just be obeyed.

To alleviate the load on the server (which is an issue we are witnessing now, see #606072: Cron should be disabled for disabled sites), that frequency can be changed by the administrator, or in the case of per site cron frequencies, a minimum can be enforced.

adrian’s picture

ignore that block. i want to remove it in any case.

that block shows the CALCULATED amount of cron jobs that will be started at the CALCULATED frequency.

it is configured by frequency. see the screenshot, you are telling it to run cron on all X sites every Y

it then splits the site crons into equal parts over the specified time period, and it has a flexibility that it starts doing every 10 minutes, but once it reaches a threshold of Z sites per run , it spawns more frequent processes.

I still think we should run them in paralel, because we don't need any output from the script, and holding up the spawning of more cron jobs for the previous ones to finish means we will run into situations where the previous batch hasn't finished when the new one starts.

adrian’s picture

StatusFileSize
new8.61 KB

screenshot

adrian’s picture

Status: Active » Closed (won't fix)

Closing this , even though it's not really a duplicate it's the exact opposite of
#695244: hosting-cron killed my server