How do you measure where time goes in a slow HTTP request?
BeginnerScenarioPerformance, MTU, Latency & Tools
Answer
Situation read → Break the request into DNS, connect, TLS, first byte and transfer.
What I'd do →
- Run
curl -o /dev/null -s -w 'dns=%{time_namelookup} connect=%{time_connect} tls=%{time_appconnect} ttfb=%{time_starttransfer} total=%{time_total}\n' https://example.com - High dns means resolver trouble
- High connect means network path or SYN drops
- High tls means handshake cost
- High ttfb minus tls means the backend is slow
Why → Each phase points to a different layer and a different owner.
Interview tip → Say you keep a curl format file for this in your toolkit.
More on Performance, MTU, Latency & Tools
Latency, bandwidth and throughput: what is the difference and why does it matter?BeginnerWhen do you use ping, traceroute and mtr?BeginnerWhat is MTU and what is the usual value?BeginnerHow do you check what is listening on a port and who is connected?BeginnerWhat does tcpdump do and what are the first filters you use?BeginnerTCP or UDP: how do you choose for an application?Beginner