DVA-C02 Question 26
Select 3You are developing a serverless application using AWS Lambda. Your Lambda function processes event messages from an Amazon SQS queue. Occasionally, your function fails to process certain messages due to transient issues, and you want to ensure these messages are retried with minimal impact on the queue's throughput. Additionally, if a message repeatedly fails processing, it should be sent to a separate queue for further inspection. What combination of features should you implement to achieve this?
- A
Configure the Lambda function to use retries with exponential backoff and jitter
- B
Set up a Dead-letter Queue (DLQ) for the SQS queue
- C
Enable long polling on the SQS queue
- D
Use Amazon SNS to fan out messages to multiple Lambda functions
- E
Configure a maximum retry count for the Lambda function's event source mapping
Show answer and explanation
Correct answers: A, B, E
Explanation
To design a fault-tolerant system for processing SQS messages with Lambda, you should implement retries with exponential backoff and jitter to handle transient failures. Additionally, configuring a Dead-letter Queue (DLQ) ensures that unprocessable messages are moved to a separate queue for further analysis. Setting a maximum retry count in the event source mapping ensures that messages do not get stuck in an infinite retry loop, enhancing overall system reliability.
- A. Correct.
Correct: Retries with exponential backoff and jitter help handle transient issues by reducing the load on downstream services and minimizing throttling.
- B. Correct.
Correct: A Dead-letter Queue (DLQ) allows messages that fail processing after a set number of retries to be sent to a separate queue for debugging and inspection.
- C. Incorrect.
Incorrect: Enabling long polling can reduce the number of empty responses from the queue but does not directly address retries or fault tolerance.
- D. Incorrect.
Incorrect: Using Amazon SNS for fan-out is unrelated to handling failed messages or retries in this scenario.
- E. Correct.
Correct: Setting a maximum retry count in the Lambda function's event source mapping ensures that failed messages are retried a specific number of times before being sent to the DLQ.