Blankman
Blankman

Reputation: 266988

How would a job scheduler like quartz work when you have multiple servers?

When you have multiple servers all running the same web application, how would you make sure multiple jobs don't get fired off (the same job)?

Would you have to use the database to monitor if the job was already run?

Upvotes: 5

Views: 2670

Answers (2)

Martin
Martin

Reputation: 38289

I've solved this by only letting one of the servers run the scheduled jobs. If that job server goes down I reconfigure another server to start running jobs in its place. In my case the jobs are not all that critical so I can afford this type of "cold standby" solution.

There are however alternatives, Quartz can run with clustered schedulers and job stores. Read more here.

Upvotes: 5

mhvelplund
mhvelplund

Reputation: 2341

See http://quartz-scheduler.org/documentation/quartz-2.x/configuration/ConfigJDBCJobStoreClustering . It appears that Quartz has a mechanism for this out of the box.

Upvotes: 1

Related Questions