By orthoducks on
My first Drupal site will go live soon, and I need to recommend a time interval for running the cron task.
The Drupal documentation gives some general guidelines for setting the time interval, but I'd like to base a written recommendation to my client on something a little more concrete. I'd also like to be able to recommend changes proactively as the site's usage patterns evolve.
Is there any way I can measure the effect of running cron at some particular interval; for example, the amounts of various resources it will recover?
Comments
BUMP
I gather that this is a difficult subject (as in, "There are no good answers").
Nevertheless, I'd appreciate any guidance that more experienced developers can offer.
One possibility has occurred to me: that we could monitor the size of the database and run cron at an interval when it typically grows xx percent over its original size. If this is a good idea, it remains to determine what xx should be.
Periodically plus manually?
If you run cron manually after submitting an article, etc., then your content would always be indexed. You can do this in addition to scheduled runs. Of course, this would not index content submitted by the general public. If being able to search through comments is important, hourly or even more frequent runs might be indicated.
Good point
Good point -- I hadn't considered the fact that cron updates indexes.
At present the site has nothing to index, but a user forum will probably be in the first round of enhancements, and then it will matter.
Can I just add a couple of
Can I just add a couple of questions:
How often cron should run depends on the jobs that are being done, right? We all know about content indexing and the 'search' feature, and can set cron up for that based on how fast we need new content to be incorporated into searches (for me, four times a day is enough). But...
1)
Is there anything else in core which uses cron? If so, what are those jobs?
2)
What about the contributed modules?
How can we tell which ones use cron jobs, and what jobs are being done?
Is there an easy way to find out this information? For instance, can a cron-run be set-up to email you telling exactly what was done during that run and which script instigated the job?
Cheers.
Good questions
Good questions. I think I can answer #2: if a module uses cron it should have a module_hooks_cron function. Studying that function will (in principle) tell you what the hook does. This should apply to core modules as well as contributed modules.
I'd like to find out the answer to #1 too.
A simplified answer
From http://drupal.org/getting-started/6/install/cron
As for a more detailed answer, I just did some reverse engineering:
No doubt there are other cron hooks in other core modules. I don't have time to delve deeper this morning, but the code is generally adequately commented.
I'd be interested in what else you come up with.
> I'd be interested in what
> I'd be interested in what else you come up with
I don't know how to get any more information. All I can gleam (from cron emails) is that when cron runs on a new installation of D6.3 (with a handful of modules installed that should be dormant as far as cron is concerned), cron sends one email every minute for the next 46 minutes telling me something about setting a session cookie.
I don't have search, cache or logging enabled, nor any content or users, nor anything else I can think of that would be using cron. I'd really like to know what drupal is doing in the background, simply so I don't get suspended from my webhost for too much cron activity - currently I have no idea what kind of resources are being used.
Cheers.
I'm probably not qualified to answer
...and with a couple exceptions, those who are probably quit looking at this thread a couple days ago. If there's not already a thread about this problem, I'd post as a new topic, and include a copy of the e-mail.
It seems that running cron isn't essential for you, so to avoid troubles with your landlord, I'd make cron a weekly task, or just run it manually, until you get this under control.
I'm still trying to figure out how to get cron to run at all on my host. I just run it after I update something.