Profiling a Laravel beanstalkd queue using Blackfire.io - laravel

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?

Related

How to check running scheduler jobs in laravel 5.2 on live server?

How to check running scheduler or cron jobs in laravel 5.2 on the live server?
I want to know how to find running cron job in on my laravel project?
You can check jobs table for this. If you do not have this table yet, then you can create it by running the following commands:
php artisan queue:table
php artisan migrate
and set your queue driver to database in config/queue.php. the created table will hold currently active jobs along with number of attempts.

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

Laravel 5.4 beanstalkd multiple workers

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.

running laravel queue listen when exiting terminal

I have setup job in laravel thats time consuming so user get upload file and exit, and it works just fine when I do php artisan queue:listen or queue:work.
But that doesn't work when I get out of terminal. What do I need to do to have it work automatically?
I've tried amazon aws sqs, but that's useless because I can queue the job but thats about it, it doesn't have option to set endpoint to hit on job received.
I know there is iron.io but that outside of my budget.
Below is my code to push the job to database
public function queue()
{
$user = Property::find(1);
$this->dispatch(new SendReportEmail($user));
}
I cannot say Amazon sqs is useless
you can use a job on your scheduled jobs in laravel and use taht to recieve jobs from amazon sqs which has reference to the file / row to be processed and you can get the payload for the job and accordingly process that with the scheduled job.
For help here is a tutorial on setting up a queue listener for sqs via laravel

Can I trigger Laravel jobs from a controller instead of using the `php artisan queue` process

We are running our production system on Elastic Beanstalk. We want to be able to take advantage of EBS' worker tiers with autoscaling. Unfortunately, due to how Laravel queue processing works, Laravel expects all queues to be consumed by starting a php command line process on your servers. EBS worker tiers don't function that way. AWS installs a listener daemon of its own, that pulls of jobs and feeds them to your worker over local HTTP calls. Sounds great. Unfortunately, I can't figure out how one would call a queued job from a route and controller in Laravel instead of using the built-in artisan queue listener task. Any clues as to how to achieve this would be greatly appreciated.
You can use the Artisan::call method to call commands from code.
$exitCode = Artisan::call('queue:work');
You can see more info in the docs
In Controller action method:
JobClassName::dispatch();

Resources