DVA-C02 Question 385
Select 4You are developing a serverless application using AWS Lambda and Amazon DynamoDB. The Lambda function retrieves data from DynamoDB and processes it. During testing, you notice that the Lambda function often times out when processing large datasets. Which of the following actions could help resolve the issue?
- A
Increase the Lambda function's timeout setting.
- B
Switch from DynamoDB's eventual consistency to strong consistency.
- C
Enable DynamoDB Accelerator (DAX) to improve read performance.
- D
Optimize the Lambda function's code to process data in smaller batches.
- E
Use AWS Step Functions to break the processing into multiple Lambda invocations.
Show answer and explanation
Correct answers: A, C, D, E
Explanation
When a Lambda function times out, it's important to address both the symptom and the root cause. Increasing the timeout can provide a temporary fix, but optimizing the function's logic (e.g., using smaller batches) or improving performance (e.g., using DAX) can resolve the issue more effectively. If the workload is too large for a single invocation, AWS Step Functions can orchestrate multiple Lambda executions to prevent timeouts.
- A. Correct.
Increasing the Lambda function's timeout setting can help handle longer processing times, but it doesn’t address the root cause of inefficiency.
- B. Incorrect.
Switching to strong consistency increases latency and is unlikely to help with Lambda timeouts in this scenario.
- C. Correct.
Enabling DynamoDB Accelerator (DAX) improves read performance, which can reduce the time taken for the Lambda function to retrieve data.
- D. Correct.
Optimizing the Lambda function’s code to process data in smaller batches can help reduce execution time and prevent timeouts.
- E. Correct.
Using AWS Step Functions to break the processing into multiple Lambda invocations can help manage timeouts by spreading the workload across multiple executions.