jeudi 1 septembre 2016

Running multiple Laravel queue workers using Supervisor

I using Laravel queues using a database driver and supervisor to keep a queue worker running all the time:

[program:laravel_queue]
command=php artisan queue:listen --timeout=1800 --tries=5
directory=/var/app/current
stdout_logfile=/var/app/support/logs/laravel-queue.log
logfile_maxbytes=0
logfile_backups=0
redirect_stderr=true
autostart=true
autorestart=true
startretries=86400
EOB

Some of the queue tasks can take around 10 minutes to complete.

I have 2 parts to the question:

1) How can i edit the above script to run multiple (e.g. 3) queue workers on the same queue.

2) Is there a way of scaling the number of queue workers running based on the number of jobs waiting to be processed?

The reason for question 2 is that we have batches of busy times and then lots of quiet times, so i don't really want to be wasting resources with 3 listeners running the whole time.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire