DVA-C02 Question 23
Single answerYou are designing a job processing system on AWS where tasks need to be processed asynchronously. The tasks occasionally fail and need to be retried without impacting other parts of the system. Which approach demonstrates the most loosely coupled architecture for handling this scenario?
- A
Use an Amazon SQS queue to store tasks and an AWS Lambda function to process them.
- B
Use an Amazon RDS database to store task details and poll the database from an EC2 instance for processing.
- C
Use an Amazon EC2 instance to directly communicate with another EC2 instance to process tasks.
- D
Use an Elastic Load Balancer to distribute tasks between EC2 instances that communicate with each other directly.
Show answer and explanation
Correct answer: A
Explanation
Loosely coupled systems separate components so that they can operate independently, enhancing scalability, fault tolerance, and flexibility. Amazon SQS ensures asynchronous communication and decouples the task producer and consumer. This makes it an ideal solution for handling tasks that may fail and need to be retried without affecting other parts of the system.
- A. Correct.
This is the correct answer. Amazon SQS is a message queuing service that decouples the producer and consumer, allowing tasks to be processed asynchronously and retried independently of other components.
- B. Incorrect.
This option is less ideal because directly polling a database introduces tight coupling between the task producer and consumer. It also lacks the scalability and resilience of a message queue like SQS.
- C. Incorrect.
This option demonstrates tight coupling because the EC2 instances directly communicate with each other, making the system less scalable, less fault-tolerant, and harder to manage.
- D. Incorrect.
This option involves direct communication between EC2 instances, which creates tight coupling and reduces the flexibility of the system. It does not provide asynchronous task processing.