Is it possible to run DJ on multiple servers?

193 views
Skip to first unread message

Vlad Katz

unread,
Oct 30, 2017, 8:24:26 PM10/30/17
to delayed_job
Can I run multiple instances of DJ, one on each server and still have queued jobs run one at a time?    I.e. if i deploy my rails app with DJ to two servers, and each of them point to the same db, and i have only one queue, what happens?  My *hope* is:

1) there are 2 items in the dj queue
2) worker from server 1 polls the db, sees that nothing is running, locks the first job, and starts running it
3) now worker from server 2 polls the db.  it sees that there is already 1 job running (and locked), so it *does nothing*.  just waits.
4) when the worker from server 1 is done running the first job, then the second job can be picked up by one of the workers

Is this how it works?

David Genord II

unread,
Oct 31, 2017, 8:13:00 AM10/31/17
to delay...@googlegroups.com
No. All worker queues, not just DJ, try to get things done as fast as possible. They will pick up and immediately start working on any available job. If another server, or process as you can run multiple on one server, is currently working on a job, that job is not available but the rest are.

What is your reason for only ever wanting one job running?

David Genord II

--

---
You received this message because you are subscribed to the Google Groups "delayed_job" group.
To unsubscribe from this group and stop receiving emails from it, send an email to delayed_job+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages