Laravel 5.4 beanstalkd multiple workers - laravel-5

I have a million tasks in the queue that sends bulk sms. I am using the beanstalkd driver to as my queue driver. I have installed beanstalk and supervisord on my ubuntu machine.
In the docs - http://supervisord.org/configuration.html i foundnumprocs=5 for instance. Does this create five workers?.
If i have two different workers, will i have 5 processes for each worker?.

See here the link to the Laravel 'config' regarding supervisord.
Queues Supervisor Config
In this example, the numprocs directive will instruct Supervisor to run 8 queue:work processes and monitor all of them, automatically restarting them if they fail.

Related

Laravel 7 - Stop Processing Jobs and Clear Queue

I have a production system on AWS and use Laravel Forge. There is a single default queue that is processing Jobs.
I've created a number jobs and now wish to delete them (as they take many hours to complete and I realize my input data was bad). I created a new job with good data, but it won't be processed until all the others have finished.
How can I delete all jobs?
It was previously set up using redis queue driver. I could not figure out how to delete jobs, so I switched the driver to database, and restarted the server, thinking that this would at least get the jobs to stop processing. However, much to my dismay, they continue to be processed :-(
I even deleted the worker from the forge ui and restarted the server: the jobs still process.
Why do jobs continue to be processed?
How can I stop them?
You can use:
php artisan queue:clear redis
It will clear all jobs from default queue on redis connection. If you put jobs in other queue then you should specify queue name for example:
php artisan queue:clear redis --queue=custom_queue_name

Laravel - Is there a way to run a queued job from another queued job on different queue?

Imagine:
1- Eating job
2- Drinking job
3- Eating Queue
4- Drinking Queue
If I have an Eating Job running on Eating queue and from this job I want to run Drinking Job but on Drinking Queue.
Is it possible?
I just found what solves my problem.
Instead of using php artisan queue:work I used php artisan queue:listen on the job that runs another job on the different queue.
Looks like queue:work only runs that job on the queue and doesn't affect another queue but when I used queue:listen it works fine.
A note: This is helped in the windows machine while on linux server it works normally with php artisan queue:work

How to start/stop specific horizon supervisor?

I have a horizon question. Is there horizon have a command where i can stop/pause specific supervisor?
for example: i have 5 supervisor running like supervisor-1, supervisor-2 ... supervisor-5 in horizon.php.
what i want to achieve is how to pause/stop the supervisor-1 for temporary and enable it later?
short answer: you can't. Because master supervisor will re-start all failed supervisor defined on horizon config file. But Laravel do support(not recommend) manage every single supervisor manually. Mohamed Said wrote a deep dive about how horizon works

Laravel Horizon inactive and still processing

I run my Application on Kubernetes.
I have one Service for requests and one service for the worker processes.
If I access the Horizon UI it often shows the Inactive Status, but there are still jobs being processed by the worker. I know this because the JOBS PAST HOUR are getting more.
If I scale up my worker service there will be constantly "failing" Jobs with this exception Illuminate\Queue\MaxAttemptsExceededException.
If I connect directly to the pods and run ps aux I will see that there are horizon instances running.
If I connect to a pod on which the worker is running and execute the horizon:list command it tells me that one (or multiple) Masters are running.
How can I further debug this?
Laravel version: 5.7.15
Horizon version: 2.0.0
Redis version: 3.2.4
The issue was that the Server Time was out of Sync so the "old" ones got restartet all the time

Profiling a Laravel beanstalkd queue using Blackfire.io

Suppose I have the following Laravel 4.2 queuing code that runs on the beanstalkd queue service:
Queue::push('Reporter\ImportReportData', ['report_request_id' => $id], 'import-reports');
Is there a way I could have the execution of this analyzed by the Blackfire.io service the way I would profile a CLI script run via cronjob?

Resources