V
V
Vitaly2021-03-22 09:58:24
Laravel
Vitaly, 2021-03-22 09:58:24

How does multi-process queue work in Laravel?

Hello.
Guys, tell me if I have a queue in which all tasks for working with the API of one service are placed and I need the tasks to be executed strictly in turn with an interval. I put them in the same "API" queue.
There are also other tasks (sending emails, etc.) that I put in "default".
I start the supervisor with something like this config:
[program:app-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /var/www/app/artisan queue:work --queue=API,default --tries =0 --rest=10
autostart=true
autorestart=true
stopasgroup=true
killasgroup=true
user=user
numprocs=2
redirect_stderr=true The

question is:will the "API" queue be executed first in two processes (in parallel), then the "Default" queue? Or will it be executed in parallel in one "API" process, and in the second "Default" process?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alex Wells, 2021-03-23
@Alex_Wells

You start two processes, each processing two queues in that order. That is, two simultaneously rake up the API while there is something there, and it will only come to default when the API is empty.
As soon as more tasks appear in the API, both workers will again rake only the API until it becomes empty.
For automatic balancing there is horizon.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question