简体   繁体   English

Laravel SQS工作人员挂起

[英]Laravel SQS Worker hangs

I'm running a worker that processes a sqs-fifo queue and it hangs between jobs (see the times): 我正在运行一个处理sqs-fifo队列的worker,它在作业之间挂起(参见时间):

[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? 我正在使用laravel-sqs-fifo-queue驱动程序任何想法是什么导致这个?

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. 由于您的队列驱动程序是sqs,您的队列侦听器需要通过Internet查询Amazon以获取下一个要执行的作业所需的信息(下一个作业+序列化数据),您至少会从那一刻起延迟网络延迟听众完成一项工作,并获得处理下一份工作所需信息的那一刻。 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. 此外,SQS与轮询一起使用,这意味着允许工作者在每个X片时间内向SQS请求下一个排队作业(如果可用)处理,因此您仍然可以固定到这些不连续的时间。

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. 我还在文档中看到可以设置每个队列的DelaySeconds参数,因为我看到你的延迟似乎比之前提到的延迟大得多,我也会在我的配置上检查这个参数。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM