I need help understanding the pros and cons of these 2 facilities.
Am I correct in assuming that this daemon by definitive runs in the
rails environment, whereas a cron will have to load up a rail
environment each time and thus consumer for more resources than the
daemons gem?
The difference is that a daemon is a long running process (ie
initialisation happens once), whereas a cronjob is something that is
launched repeatedly.
So yes, a cronjob spends more time loading rails/your app over and
over again, but a daemon will set on however much memory it needs all
the time, whereas a cronjob will return those resources when it has
finished. To an extent the trade off depends how often you want to
perform your task.
I need help understanding the pros and cons of these 2 facilities.
Am I correct in assuming that this daemon by definitive runs in the
rails environment, whereas a cron will have to load up a rail
environment each time and thus consumer for more resources than the
daemons gem?
The difference is that a daemon is a long running process (ie
initialisation happens once), whereas a cronjob is something that is
launched repeatedly.
So yes, a cronjob spends more time loading rails/your app over and
over again, but a daemon will set on however much memory it needs all
the time, whereas a cronjob will return those resources when it has
finished. To an extent the trade off depends how often you want to
perform your task.
Fred
The daemons gem (and plugin) can be run as per a cron-job (with regularity) - I think (?) it loads up the environment every time - but has a babysitting/launcher process to keep an eye on the spawn(ed).
FWIW, I found this gem to be problematic (would stop running for no apparent reason), and monit had troubles restarting it. I've gone back to cron to do regular tasks.
(wasn't sure if you were talking about Daemons in general or the gem/plugin. Fred's description is correct with regard to daemons in general, and so the gem might be misnamed as it seems to be a railscron)