AWS Certified Developer – Associate (DVA-C02) — Question 328
A company recently deployed a new serverless user portal. Users have reported that part of the portal is slow. The initial analysis found a single Amazon API Gateway endpoint that is responsible for the performance issues. The endpoint integrates with an AWS Lambda function. However, the Lambda function interacts with other APIs and AWS services.
How can a developer find the source of the increased response time by using operational best practices?
Answer options
- A. Update the Lambda function by adding logging statements with high-precision timestamps before and after each external request. Deploy the updated Lambda function. After accumulating enough usage data, examine the Amazon CloudWatch logs for the Lambda function to determine the likely sources for the increased response time.
- B. Instrument the Lambda function with the AWS X-Ray SDK. Add HTTP and HTTPS interceptors and SDK client handlers. Deploy the updated Lambda function. Turn on X-Ray tracing. After accumulating enough usage data, use the X-Ray service map to examine the average response times to determine the likely sources.
- C. Review the Lambda function's Amazon CloudWatch metrics by using the metrics explorer. Apply anomaly detection to the Duration metric and the Throttles metric. Review the anomalies to determine the likely sources.
- D. Use Amazon CloudWatch Synthetics to create a new canary. Turn on AWS X-Ray tracing on the canary. Configure the canary to scan the user portal. After accumulating enough usage data, use the CloudWatch Synthetics canary dashboard to view the metrics from the canary.
Correct answer: B
Explanation
AWS X-Ray is specifically designed to analyze and debug distributed applications, making it the best tool for tracing requests across multiple APIs and AWS services. By instrumenting the Lambda function with the X-Ray SDK and enabling tracing, the developer can visualize the entire call chain and pinpoint the exact source of latency on the X-Ray service map. Other approaches, such as manually adding timestamps to logs or using basic CloudWatch metrics, do not provide the detailed downstream breakdown required for complex distributed tracing.