A developer is building a high-throughput transaction ledger consumer that runs as a containerized service on Amazon ECS. The service polls messages from an Amazon SQS FIFO queue, processes the transactions, and writes the results to an external database.
The queue is configured with a default visibility timeout of seconds. Under heavy load, the database response times slow down, and processing a batch of messages can take up to seconds. Consequently, transaction records are being duplicated in the database because messages are returning to the queue before processing is complete. Additionally, the ECS task is experiencing performance degradation due to client initialization overhead.
Which of the following actions should the developer take to resolve the duplication issues and optimize client performance? (Select TWO.)
- Increase the default visibility timeout of the SQS queue to at least seconds to ensure messages remain invisible to other consumers until processing is completed.Cevap
- Instantiate the SQS client and database connection pools outside the message processing loop to reuse them across multiple execution cycles.Cevap
- CDecrease the default visibility timeout of the SQS queue to seconds to force the consumer to poll and process the messages more frequently.
- DInitialize a new instance of the AWS SDK client inside the message processing loop for every message to ensure credentials are refreshed.
- EMigrate the consumer logic to an AWS Lambda function triggered by the SQS queue, and set the Lambda function timeout to seconds.