niranjan
niranjan

Reputation: 19

Laravel queue:work does not processe a job quickly

I am running queues using Laravel and having AWS SQS connection. The queue is running using supervisord on Linux or as services on Windows. The command used to run queue process is as follows:

queue:work sqs --sleep=12 --tries=3

I see a considerable amount of time delay (from 15 seconds to 2 minutes), between point at which job is dispatched from application to the point when job is processed by the queue worker.

Note, from the application, jobs are dispatched without any delay setting:

DocumentProcessor::dispatch( $document );

Initially I noticed this behavior on a Windows server on AWS. Later observe the same on a Linux server on AWS as well. Both server process different kind of jobs. So it is seems to be not related to job or server, but it is more generic.

On the AWS queue monitor, I see there is no delay (0 delay) in delivery. Also I see regularly five (5) empty messages per minutes are processed (that mean with 12 seconds of sleep time implies 5 (=60/12) messages per minutes). So it looks like queue is working normally.

Also there is no exception or error found in the log.

Is there any other settings that is causing this delay in processing the job? (any default setting in queue configuration or on AWS.)

I was expecting a maximum delay of 12 seconds due to sleep time of queue worker. But a delay of 15 to 2 minutes is undesirable.

Upvotes: 0

Views: 897

Answers (1)

rodrigomedeiros
rodrigomedeiros

Reputation: 61

I changed the SQS Queue Config in "Receive message wait time" for 1 second and solved my problem.

Credit goes to this comment given by niranjan.

Upvotes: 1

Related Questions