A
A
Andrey Sokolovsky2017-11-01 16:26:03
Message Queues
Andrey Sokolovsky, 2017-11-01 16:26:03

How to make multiple task queues in Laravel?

Hello.
Created a task queue in Laravel. Driver - database. There is only one queue. ( https://laravel.com/docs/5.5/queues)
How to make multiple queues at the same time? For example, 5?
Works via Supervisor, current config is
[program:laravel-worker]
process_name=%(program_name)s_%(process_num)02d
command=php artisan queue:listen --queue=high,default --sleep=1 --tries=3 - -timeout=0
autostart=true
autorestart=true
user=forge
numprocs=8
redirect_stderr=true
The queue works like this. But there are many tasks, they are long. are done slowly and some users have to wait several hours, and their task takes a couple of minutes.
I did numprocs=8 and priority --queue=high,default but nothing changed.
I used the commands: sudo service supervisord restart and supervisorctl restart
to update the config file but no change. I'm thinking maybe I'm updating the file incorrectly? And when I update it for real, will everything work for me? :)
because numprocs=8, then there should be 8 parallel executions of tasks ? Or am I misunderstanding?
UPD: I checked. With the help of the sudo service supervisord restart command, the config file was still updated. those. it is relevant, however, there is only one process, despite the fact that numprocs=8 is set.
Back to the problem, how to configure so that several tasks are executed in parallel in the task queue (and not sequentially) ?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexey Ukolov, 2017-11-01
@ansk11

because numprocs=8, then there should be 8 parallel executions of tasks ?
Yes.
Once the configuration file has been created, you may update the Supervisor configuration and start the processes using the following commands:
sudo supervisorctl reread
sudo supervisorctl update
sudo supervisorctl start laravel-worker:*

For more information on Supervisor, consult the Supervisor documentation .
https://laravel.com/docs/5.5/queues#supervisor-con...

U
UksusoFF, 2017-11-01
@UksusoFF

https://github.com/barryvdh/laravel-async-queue try this

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question