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).
More on Latency
p99 latency jumped from 200 ms to 3 s right after a deploy; error rate is flat.BeginnerThe API is slow, the database shows 100% CPU, and the slow query log is full of one query doing a sequential scan.BeginnerA JVM service has latency spikes every 30–60 seconds; GC logs show "Pause Full (G1 Compaction Pause)" taking 4 seconds.IntermediateThe first request after idle takes 5 seconds; Lambda logs show "Init Duration: 4512.33 ms".BeginnerLatency grows with traffic and logs show "QueuePool limit of size 5 overflow 10 reached, connection timed out, timeout 30.00".IntermediateA container uses only 40% of its CPU limit on average, yet latency is high; `container_cpu_cfs_throttled_periods_total` keeps rising.Advanced