MichaelDaly's avatar

Laravel Queues With AWS SQS

Hi,

I am planning to set up a queue service to process user uploaded images for my app. The app will be hosted on an EC2 AWS instance, use an S3 bucket for image storage and SQS for queues.

When a user uploads an image it is stored on S3 and then a queue job is registered. The queue will then retrieve the image, resize, re-scale and save the final image back onto S3.

My question is: Is there a way to run a 'queue worker' on a separate EC2 instance away from the web app instance so the image processing backend jobs will not effect the front end web app's performance?

Any advice or guidance on this will be useful as this is my first time working with AWS and queues in general.

Thanks

Mike

0 likes
6 replies
Phillipp's avatar

Yes you can start the queue worker an every machine.

MichaelDaly's avatar

So if I have an EC2 instance dedicated to processing queued jobs, will I have to install laravel on that instance but only add the methods relative to queue processing? Then keep laravel and the main app code on a separate instance?

Or would I just use standard php files for queue processing?

I am mainly confused about the architecture of the app and the best approach for building this solution with 2 EC2 (1 small for app hosting, 1 large for queue processing) instances, 1 S3 instance and 1 SQS instance.

Phillipp's avatar

You can copy the whole app or just a "smaller" version of your app with the queue relevant classes. I prefer to copy the whole app.

1 like
MichaelDaly's avatar

thanks for the feedback.

I don't like the idea of replicating the entire app when only a handful of classes will be required - so I will see if I can create a script to automatically transfer "queue worker" files when they are committed to the repository.

Mike

jcorry's avatar

FWIW I treat queue processors as entirely standalone apps in their own right.

jmtech's avatar

Have you considered using AWS Lambda invoked by a CloudWatch schedule for this?

Please or to participate in this conversation.