Hi,
Some of the jobs that have run is consuming high cpu on db side. So I would like to dynamically alter number of jobs that are running. By the way Laravel 5.8 and I'm using laravel horizon. Thanks in advance.
Thank yo for your answer. @munazzil Actually My Question is how to dynamically change number of workers in horizon or directly artisan queue:work command
Sorry for the late response. What I do is I have a pool of workers that are managed by Horizon. The Horizon config has the 'balance' value set to auto. That way when the queues are idle, it splits the workers assigned between the queues that are defined, but when there is work to do in one queue, and not others, it dynamically changes those workers to process the other queues that have work ready.
For example, I have 2 queues and 40 workers defined. At idle, each queue has 20 workers assigned, but when items are assigned to the queue (generally there is a 100/1 ratio of items in the queues), it dynamically moves the queue workers to where the work needs to be done.