Networking & Firewall (Ss/Netstat/Iptables/Curl)
Pinpointing Network Bottlenecks with Curl HTTP Timing
🧩 The Challenge
Identifying whether latency is caused by DNS resolution, TCP handshake speed, or slow server-side response times.
💡 The Fix
Use a custom curl format string to break down the total execution time into specific networking lifecycle phases.
curl -so /dev/null -w "DNS: %{time_namelookup}s\nTCP: %{time_connect}s\nTLS: %{time_appconnect}s\nTTFB: %{time_starttransfer}s\nTotal: %{time_total}s\n" https://google.com
⚙️ Why It Works
This command maps individual time variables provided by curl to visualize exactly which stage of the HTTP request is consuming the most wall-clock time.
🚀 Pro-Tip: Save this format string to a file as ~/.curlrc using the -w option to generate timing metrics automatically on every request.
Linux Tips & Tricks | © ngelinux.com | 7/7/2026
