Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

qwertynik's avatar

Using AWS SQS for queues and keeping the request count low

Hello,

A script to parse and load user data into the system leverages queue to process user's images. The queue for the application is hosted by AWS SQS. However, there is an unusually high number of requests on the queue. From the stats, came to know that it is because of 'Empty Receives'.

A couple of solutions to reduce the 'Empty Receives':

  1. Enable Long Polling option on the SQS queue. However, not sure how this will impact queue processing. Sharing any experience in using this option will help.

  2. Run the queue worker periodically with the --stop-when-empty option. Should suit some use-cases but not this one.

  3. At the end of the script, trigger the queue processing in the background with the --stop-when-empty option using the exec function.

Option 3 seems to be the best one for this use-case.

Is there any other better way to achieve this?

0 likes
2 replies
chaudigv's avatar

Using --stop-when-empty is a good use case for SQS.

In my case, I just stick with Supervisor on my ec2 instance.

1 like
qwertynik's avatar

Yes, @chaudigv. Given the use-case, that's the best option I can think of. Using option 3

Please or to participate in this conversation.