Laravel 5.7 - 队列作业太慢
Laravel 5.7 - Queues Jobs are too slow
我使用 Laravel 5.7 和 3 个队列作业,作业之间的时间太长 long/slow。
我在第一份工作中 foreach 项目的 RSS 提要,我在第二份工作中发送这个项目,等等......我没有输入细节,但有一些荒谬的小计算,一定不会花时间。
问题是每次派遣工作都需要花费大量时间。 Horizon 和 Telescope 不允许我调试。
我用的机器有32GB内存,有几个进程(每个15个)翻尾
[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
我在 laravel.log 中有这个错误:
production.ERROR: App\Jobs\FeederJob has been attempted too many times
or run too long. The job may have previously timed out.
我遇到了同样的问题并进行了大量搜索,但没有任何帮助,甚至 horizon Github 中也有一些关于此错误的问题,但没有有用的解决方案。问题是关于繁重任务的 horizon 和 Redis 错误。
最后,我从 Redis 和 horizon 切换到 SQL 数据库(无论你在你的项目中为我使用 mssql)作为队列连接,它解决了问题
注意:在你的 artisan 命令中使用 --timeout=0
默认情况下 laravel 队列在没有可用作业时休眠 3 秒。
你应该使用 --sleep=0
选项
我使用 Laravel 5.7 和 3 个队列作业,作业之间的时间太长 long/slow。
我在第一份工作中 foreach 项目的 RSS 提要,我在第二份工作中发送这个项目,等等......我没有输入细节,但有一些荒谬的小计算,一定不会花时间。
问题是每次派遣工作都需要花费大量时间。 Horizon 和 Telescope 不允许我调试。
我用的机器有32GB内存,有几个进程(每个15个)翻尾
[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
我在 laravel.log 中有这个错误:
production.ERROR: App\Jobs\FeederJob has been attempted too many times or run too long. The job may have previously timed out.
我遇到了同样的问题并进行了大量搜索,但没有任何帮助,甚至 horizon Github 中也有一些关于此错误的问题,但没有有用的解决方案。问题是关于繁重任务的 horizon 和 Redis 错误。
最后,我从 Redis 和 horizon 切换到 SQL 数据库(无论你在你的项目中为我使用 mssql)作为队列连接,它解决了问题
注意:在你的 artisan 命令中使用 --timeout=0
默认情况下 laravel 队列在没有可用作业时休眠 3 秒。
你应该使用 --sleep=0
选项