Closed gmcnaught closed 7 years ago
@gmcnaught So we have to disable job schedule events on the process(main) that schedule them and enable them on the process(worker or background) that process them.
@gmcnaught I think we should start by looking on how kue handle multi-process then we can take motivation from it.
@gmcnaught I made you collaborator. Thanks for your much thoughts and contributions. Feel free to push this project to maturity.
@gmcnaught Because kue-scheduler
use key-expiry events
to schedule reccur job wont it be a block for us to scale it to multiple process with separation of responsibilities.
Thank you for adding me, I think this is a great project and it is fun to assist on.
Regarding your comments, I believe this should follow the examples of how kue works: https://github.com/Automattic/kue#parallel-processing-with-cluster
Kue, and kue scheduler both use redis exclusively to coordinate what process is building the scheduler so if it is safe to run across multiple processes, we should be able to spread that out across multiple servers on the LAN.
Essentially what I was thinking is this as my use case:
1) You could have some set of processes (or even servers!) that their sole job is to catch the key-expiry event for scheduling and schedule the next job run. Now when
2) Other processes connecting to the same kue instance would only process work on the queue.process - that way they don't catch all of the scheduling events and they are - in theory - more efficient in picking up work evenly.
Perhaps it would make sense to do like the option of whether to configure the key-expiry on kue instantiation:
kue.createQueue({
skipConfig: true
scheduleJobs: false //default to true?
});
@gmcnaught Perfectly explained...and it make sense.
So if the scheduleJobs
config provided then the process will be listening to expiry events and queue schedules job for next run. Is it?
Thanks.
Implemented. See v0.7.0 release. You will have to pass an option worker
to set your current kue-scheduler
as worker or not. If woker:true
you instance will process the job otherwise not.
I would like to run a multi-process distributed deployment of Kue-Scheduler and I'd like to be able to have a separation of duty between processes which schedule the next jobs, and processes which pick up and handle work.