DVA-C02 exam dumps

DVA-C02 practice question 41 of 399

AWS Certified Developer - Associate. Associate level, Amazon Web Services. Free question with the correct answer and a full explanation.

DVA-C02 Question 41

Single answer

You are developing a serverless application that processes messages from an Amazon SQS queue using an AWS Lambda function. You configure an event source mapping to trigger the Lambda function whenever new messages are available in the queue. However, you notice that some messages are not being processed, and after troubleshooting, you determine that the batch size for the event source mapping is causing issues. What action should you take to ensure all messages are processed while maintaining optimal performance?

  1. A

    Increase the batch size in the event source mapping configuration to process more messages per invocation.

  2. B

    Decrease the batch size in the event source mapping configuration to ensure smaller batches are processed at a time.

  3. C

    Set the batch size to 0 in the event source mapping configuration to disable batching.

  4. D

    Enable a dead-letter queue (DLQ) for the Lambda function to capture unprocessed messages.

Show answer and explanation

Correct answer: B

Explanation

The batch size in an event source mapping determines how many messages are passed to the Lambda function in a single invocation. If the batch size is too large, the function may fail to process all messages, resulting in unprocessed messages. Decreasing the batch size can help by reducing the load on each invocation and ensuring all messages are processed successfully. This is the most appropriate action to resolve the issue described in the scenario.

  • A. Incorrect.

    Increasing the batch size may improve throughput but could lead to more unprocessed messages if the Lambda function cannot handle larger batches effectively.

  • B. Correct.

    Decreasing the batch size ensures the Lambda function processes smaller batches, reducing the likelihood of errors and unprocessed messages.

  • C. Incorrect.

    Setting the batch size to 0 is not valid because the batch size must be a positive integer between 1 and 10 for SQS as an event source.

  • D. Incorrect.

    While enabling a DLQ is a good practice for handling failed messages, it does not address the underlying issue of batch size causing unprocessed messages.

Timed practice exam

Take a DVA-C02 practice test under exam conditions

65 questions in 130 minutes, drawn from this bank, with a score report and a per-question review when you finish.

Start timed exam