Troubleshooting and Optimization

An API on Amazon ECS shows rising p99 latency while CPU utilization and the SQL execution times in its AWS X-Ray traces stay low. Slow traces show a long gap before the first database call, and the application's connection pool stays at its limit. Which action BEST confirms whether requests are waiting for pooled connections?

Show the answer

Correct answerA. Add an X-Ray subsegment around connection acquisition and publish pending pool requests as a CloudWatch custom metric.

AWhy this is right: Timing connection acquisition in X-Ray and graphing pending pool requests in CloudWatch directly measures the suspected wait.

BWhy not this: Averages hide p99 behavior, and an open-connection count already at its limit cannot separate waiting from other application work.

CWhy not this: Sampling more requests still measures only SQL execution, not the time spent before a connection is obtained.

DWhy not this: Database CPU is already low, so finer database metrics do not reveal time spent waiting inside the application.

An X-Ray subsegment around connection acquisition makes the wait for a pooled connection visible in each trace, and a CloudWatch custom metric for pending pool requests shows contention across all requests. More SQL samples, database CPU or average latency still leave the time before a connection is acquired unmeasured.