DVA-C02 Question 34
Single answerYou are developing an AWS Lambda function to process images uploaded to an Amazon S3 bucket. The function must read the object metadata and trigger additional processing. However, during testing, you notice that the Lambda function times out when processing large files. Which of the following steps should you take to resolve this issue?
- A
Increase the Lambda function's timeout setting in the function configuration.
- B
Enable AWS X-Ray tracing for the Lambda function to identify performance bottlenecks.
- C
Use AWS Step Functions to split the processing into multiple smaller Lambda functions.
- D
Increase the Lambda function's memory allocation to improve processing speed.
Show answer and explanation
Correct answer: A
Explanation
The Lambda function is timing out because the operation takes longer than the default timeout setting (3 seconds). By increasing the timeout in the Lambda function's configuration, you allow the function to complete its processing of large files without prematurely halting. Other options, such as increasing memory or enabling AWS X-Ray, may improve performance or provide diagnostic information but won't necessarily resolve timeout issues directly.
- A. Correct.
Correct: Increasing the Lambda function's timeout allows it to run for a longer period, which is necessary when processing large files that take more time to complete.
- B. Incorrect.
Incorrect: While enabling AWS X-Ray can provide insights into performance bottlenecks, it doesn't directly address the timeout issue.
- C. Incorrect.
Incorrect: Using AWS Step Functions can help manage complex workflows, but it's not necessary in this scenario as the issue is related to timeout, not workflow design.
- D. Incorrect.
Incorrect: Increasing memory allocation can improve processing speed, but it won't directly address the timeout issue for very large files if the default timeout is still too low.