Networking & Firewall (Ss/Netstat/Iptables/Curl)
Debugging Latency with Curl Trace Metrics
🧩 The Challenge
Network performance issues are often caused by hidden delays in DNS lookup, TCP handshakes, or server processing time that standard pings cannot reveal.
💡 The Fix
Use curl’s write-out feature to output granular timing statistics for every phase of the HTTP request lifecycle.
curl -so /dev/null -w "DNS: %{time_namelookup}s\nTCP: %{time_connect}s\nTTFB: %{time_starttransfer}s\nTotal: %{time_total}s\n" http://example.com
⚙️ Why It Works
This command suppresses the response body and displays specific timestamps provided by libcurl, isolating exactly where the request is stalling.
🚀 Pro-Tip: Add the -v flag to the command to also inspect the raw request and response headers in real-time.
Linux Tips & Tricks | © ngelinux.com | 7/5/2026
