0
votes

How can I make laravel queue:work to process jobs as many as possible? (With either redis or beanstalkd)
By default it is processing 1 job at the same time, but I need it to run multiple jobs at the same time, until CPU has free space.
Any help is appreciated.

2

2 Answers

1
votes

It depends on how you are running the worker(s), and how you can increase the number of workers that are being started to get items from the queue and run them.

If you are using supervisord to run the workers, it could be as easy as increasing the numprocs in the configuration.

You would not usually set it to a very large number, as trying to run too many processes at once is likely to end up as a major problem when things run out of memory or CPU.

0
votes

Have a look at this listener. The best it is that it runs workers depending of how many load you have in your queue, and it is very easy to configure. So, when you require much more workers, since it is spawning workers automatically, the new ones will handle the task... If there's no need of more workers, since the previously spawned are killed, there will be a minimum consuming only a few resources from your PC. You can tune depending of your needs and server capabilities.

https://github.com/smaugho/TunedQueue