dsifjgogw48491752 2019-06-05 14:52
浏览 89
已采纳

Laravel SQS工作人员挂起

I'm running a worker that processes a sqs-fifo queue and it hangs between jobs (see the times):

[2019-06-05 14:28:10] Processing: App\Jobs\MyApp\MyJob
[2019-06-05 14:28:10] Processed:  App\Jobs\MyApp\MyJob
[2019-06-05 14:28:23] Processing: App\Jobs\MyApp\MyJob
[2019-06-05 14:28:23] Processed:  App\Jobs\MyApp\MyJob
[2019-06-05 14:28:34] Processing: App\Jobs\MyApp\MyJob
[2019-06-05 14:28:34] Processed:  App\Jobs\MyApp\MyJob
[2019-06-05 14:28:34] Processing: App\Jobs\MyApp\MyJob
[2019-06-05 14:28:35] Processed:  App\Jobs\MyApp\MyJob
[2019-06-05 14:28:38] Processing: App\Jobs\MyApp\MyJob
[2019-06-05 14:28:38] Processed:  App\Jobs\MyApp\MyJob

I am using laravel-sqs-fifo-queue driver Any idea what can cause this?

  • 写回答

1条回答 默认 最新

  • douzhuo2722 2019-06-05 16:07
    关注

    From what I know nothing guarantees that after a job has been processed the next job would start inmediately after with no delay. As your queue driver is sqs, your queue listeners need to query Amazon through the internet to get the information needed for the next job to be performed (the next job + the serialized data), you would at least have that network delay from the moment the listener finishes a job and the moment it has the information required for processing the next one. In a multiple listeners scenario that would not be a problem, you can assume a bit of delay among jobs processed by the same listener as other listeners would be concurrently dealing with other queued jobs, but I'm afraid that if you need to sequentially deal with those queued jobs at least that delay is unavoidable.

    Also SQS works with polling, that means that every X slices of time the worker is allowed to ask SQS for the next queued job to handle if available, so you are still fixed to these discrete amounts of time.

    I've also seen on the documentation that a DelaySeconds per queue parameter can be set, as I see your delay seem to be quite bigger than the one mentioned before, I would also check for this parameter on my configuration.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 CST怎么把天线放在座椅环境中并仿真
  • ¥15 任务A:大数据平台搭建(容器环境)怎么做呢?
  • ¥15 r语言神经网络自变量重要性分析
  • ¥15 基于双目测规则物体尺寸
  • ¥15 wegame打不开英雄联盟
  • ¥15 公司的电脑,win10系统自带远程协助,访问家里个人电脑,提示出现内部错误,各种常规的设置都已经尝试,感觉公司对此功能进行了限制(我们是集团公司)
  • ¥15 救!ENVI5.6深度学习初始化模型报错怎么办?
  • ¥30 eclipse开启服务后,网页无法打开
  • ¥30 雷达辐射源信号参考模型
  • ¥15 html+css+js如何实现这样子的效果?