Recently we were involved in a debate: if my service processes messages from a queue, is it better to create a worker environment or a web tier environment?
Without pretending that there is only one correct answer, we argued that is better to create from the beginning an environment that has a web server behind. There is only one minus for that – cost of the load balancer, but when we compare that with the benefits, it makes us reconsider the option:
- Web tier apps give you flexibility to change SQS with other queue solutions
- You can add APIs. From our experience, sooner or later it occurs an use case where it’s necessary an API. Also this interaction mechanism gives you more flexibility and more control over your application
- There are already many libraries that integrates SQS (here) – supposing you want to use that – with your API framework, so the “magic” given by a worker environment it’s not a big deal.
- Load balancer health check is a better mechanism to ensure your application is up and running.
- Imagine that you setup a dead letter queue from where you want to process items. At this moment, we don’t know any mechanism to do that within the same worker app. With a web based application, you can process messages from whatever places you want.
Again, these are our opinions. It would be great if you want to continue this debate with us by adding a comment below.
Happy cloud computing!