After turning on TLS between internal services, p50 latency doubled.
IntermediateTroubleshootingLatency
Answer
Likely causes → Clients open a new connection per request, so every call now pays a full TCP plus TLS handshake (one or two extra round trips plus crypto). Missing session resumption makes it worse.
Diagnose →
ss -tan state time-wait | wc -l # huge count = no connection reuse
curl -w 'tls:%{time_appconnect}\n' -o /dev/null -s https://orders.internal/health
Fix → Reuse connections: shared HTTP client with keep-alive and a pooled transport, HTTP/2 where possible, and TLS 1.3 (one-round-trip handshake).
Prevent → Create HTTP clients once per process (not per request), and monitor new connections per second per service.
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