-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(worker): Parallel execution #58
Comments
Hi @checkphi 👋🏻 Yes, all tasks are executed sequentially, to be honest, Messenger cannot natively consume messages in parallel so IMHO, there's no benefit of working on something related to Messenger. I have plans to work on something that can execute tasks in parallel thanks to What do you have in mind to bring parallel execution? |
Maybe I understood the documentation and concept of messenger wrong, but is it not possible to run multiple In other words, if we start 3 additional "scheduler workers" then we could process 3 scheduled jobs in parallel? |
Thanks to Supervisord, you can trigger multiple worker (same concept applies to this bundle), each worker will consume messages available at the moment.
In theory, yes, keep in mind that a lock is applied to every task before executing it so it may depends on the transport which is used (Doctrine use a resource lock, same things applies to Redis). |
So you say that I should simple start multiple |
Yes, for now, I don't have an other solution sadly 🙁 If you have one, feel free to contribute and we'll see if it can be integrated. |
I'm thinking about multiple solutions which I would be happy to discuss. |
Hi @checkphi 👋🏻 Consider using discussions: https://github.com/Guikingone/SchedulerBundle/discussions This way, we can track the discussion and open related issues if required 🙂 |
Hi @Guikingone , |
Hi @grimgit 👋🏻 Actually, the call to
What's the idea behind this approach? If I'm right, locking the consume tasks isn't useful as they're "consumed" and not retrieved until next minute 🤔 |
Suppose to have a very long task, for example 1 hour task, all the others tasks are locked and will be delayed of 1 hour, even if i'm running multiple consumer. |
Actually, tasks are locked "per processes" depending on the store that you're using. Here's the explanation of what happen internally:
If the process
I think I get the point that you're mentioning (stop me if I'm wrong):
Am I right? If I am, yes, it could be improved, feel free to submit a PR to improve it, we can discuss about the implementation / improvements 🙂 |
It's correct, process So the consumer process should:
|
Currently it seems like all scheduled jobs are executed sequentially.
Would it be possible to leverage the messenger system somehow so that each job (or a defined number of jobs) can run in parallel?
The text was updated successfully, but these errors were encountered: