The ALB's `TargetResponseTime` p99 is 2 s, but the app's own metrics say p99 is 150 ms. Where is the time going?

IntermediateTroubleshootingLatency
Answer

Likely causes → The time is spent between the LB and your handler: requests queued in the app server's accept backlog or worker pool before your timer starts, a sidecar or reverse proxy in front of the app, or CPU throttling stalling the process.

Diagnose → Compare timestamps across layers: ALB access logs (target_processing_time), nginx $request_time vs $upstream_response_time, and app span start. Check worker saturation (gunicorn/puma busy workers) and throttling.

Fix → Add workers or replicas, and move the app's timer to the outermost middleware so it measures queue time too.

Prevent → Measure latency at every hop and export a request-queue-time metric (for example from the X-Request-Start header).

All Real-World Interview questions Roadmap: Interview readiness

More on Latency