ref: http://stackoverflow.com/questions/1029383/time-triggered-job-cron-or-quartz
Q:
Q:
I already asked a separate question on how to create time triggered event in Java. I was introduced to Quartz. At the same time, I also google it online, and people are saying
cron in Unix is a neat solution.
Which one is better? What's the cons and pros?
Some specification of the system: * Unix OS * program written in Java * I have a task queue with 1000+ entries, for each timestamp, up to 500 tasks might be triggered.
A:
- Using
cronseems to add another entry point into your application, whileQuartzwould integrate into it. So you would be forced to deal with some inter-process communication if you wanted to pass some information to/from the process invoked fromcron. InQuartzyou simply (hehe) run multiple threads. cronis platform dependent,Quartzis not.Quartzmay allow you to reliably make sure a task is run at the given time or some time after if the server was down for some time. Purecronwouldn't do it for you (unless you handle it manually).Quartzhas a more flexible language of expressing occurences (when the tasks should be fired).- Consider the memory footprint. If your single tasks share nothing or little, then it might be better to run them from the operating system as a separate process. If they share a lot of information, it's better to have them as threads within one process.
- Not quite sure how you could handle the clustering in the
cronapproach.Quartzmight be used with Terracotta following the scaling out pattern (I haven't tried it, but I believe it's doable).
No comments:
Post a Comment