The AWS Well-Architected Framework describes the queue-based architectural style as a way to offload compute intensive operations from clients. It is ideal as a model to quickly scale and respond to bursts of requests in a short period of time to support processing of periodic tasks, background jobs, asynchronous flows, etc. The architecture is composed of clients sending commands to a queue which are processed by a dedicated worker.
The following diagram is an example of what a queue based architecture would look like.
Components
- Users initiate requests through their frontend system. This frontend system can be a web application, a terminal, a mobile device, or a third party system.
- Requests are stored and queued as messages in Amazon SQS.
- Workers are hosted in EC2 instances running within an autoscaling group. The workers use NServiceBus to pull messages from the Amazon SQS queue, process the messages, and store business data in a data store.
Challenges
The queue-based architectural style is suitable for simple business domains. Without careful design, the front end systems and the worker can become complex, monolithic components that are difficult to maintain. For more complex business domains, consider event-driven or microservices architectural styles.
Technology choices
The queue-based architectural style can make use of AWS managed services such as AWS EC2 Instances, AWS Lambda, AWS Amplify, Amazon Cloud Watch, Amazon DynamoDB, Amazon DocumentDB, Amazon Aurora, Amazon S3, amongst others. Amazon SQS is a powerful messaging technology choice.