pirmax
pirmax

Reputation: 2153

Laravel 5.7 - Queues Jobs are too slow

I use Laravel 5.7 and 3 queues jobs, the time between jobs is too long/slow.

I foreach items of RSS feeds in the first job, and I dispatch this item in second job, etc... I don't enter in details but there are some ridiculous little calculations that must not take time.

The problem is that every dispatch to a job takes a lot of time. Horizon and Telescope do not allow me to debug.

The machine I use has 32 GB of RAM, and there are several processes (15 each) that turn the tails.

[program:mywebsite_feeder]
command=/RunCloud/Packages/php72rc/bin/php artisan queue:work redis --queue=feeder --tries=3 --sleep=0
directory=/home/runcloud/webapps/mywebsite
redirect_stderr=true
autostart=true
autorestart=true
user=runcloud
numprocs=15
process_name=%(program_name)s_%(process_num)s

I have this error in laravel.log:

production.ERROR: App\Jobs\FeederJob has been attempted too many times or run too long. The job may have previously timed out.

Upvotes: 5

Views: 5683

Answers (2)

Mirahmad Mirzajonov
Mirahmad Mirzajonov

Reputation: 316

by default laravel queues sleep 3 seconds when there are no jobs available. u should use --sleep=0 option

Upvotes: 1

Milad Teimouri
Milad Teimouri

Reputation: 1211

I had the same issue and did a lot of searches but nothing help, even there is some issues about this bug in horizon Github but without a useful solution. the problem is about horizon and Redis bug for heavy tasks.

finally, I switch from Redis and horizon to SQL database (whatever you use in your project for me mssql) as queue connection and it fixed the problem

notice: use --timeout=0 in your artisan command

Upvotes: 0

Related Questions