Closed georgms closed 1 year ago
Thank you for reporting this issue!
As Laravel is an open source project, we rely on the community to help us diagnose and fix issues as it is not possible to research and fix every issue reported to us via GitHub.
If possible, please make a pull request fixing the issue you have described, along with corresponding tests. All pull requests are promptly reviewed by the Laravel team.
Thank you!
Hi @georgms,
it seems to me that the current behaviour you are explaining is exactly what the 'auto' mode should do.
See documentation: https://laravel.com/docs/9.x/horizon#balancing-strategies
The
auto
strategy adjusts the number of worker processes per queue based on the current workload of the queue. For example, if yournotifications
queue has 1,000 pending jobs while yourrender
queue is empty, Horizon will allocate more workers to yournotifications
queue until the queue is empty.
I guess the reason behind this is to avoid having jobs which will never be resolved if all processes go to the highest priority queue.
Remember it is for 'balancing' you want to even out the number of processes between all queues. I think what you are looking for is just the default Laravel behaviour. Set balancing to 'false' to let Horizon process the queues by the order you have configured.
you have to set it to false
if you want the default behavior of priority. Note you can't use min-processes and max-processes with the false
balance, you can only use processes
.
'balance' => 'false',
'processes' => 1
When the balance option is set to false, the default Laravel behavior will be used, wherein queues are processed in the order they are listed in your configuration.
It would be nice though if horizon offered a min-process and max-process based on workload together with the false
balance in order to prioritize jobs.
Read more here
Thanks for the additional explanations @florisbosch @bernardwiesner! Turning off balancing actually does pretty much what I want. Closing this.
Description:
queue
option where multiple queues can be configured.auto
balance mode, Horizon would assign most workers to the highest priority queue if it is not empty in order to empty it as fast as possible.Steps To Reproduce:
horizon.php
configure Horizon like so:default
queue and 1.000 jobs on thelow
queue.Expected:
Horizon assigns most workers to the
default
queue because it has the higher priority.Actual:
Horizon assigns most workers to the
low
queue because it has more pending jobs: