Tracking Connection Latency with Curl

Networking & Firewall (Ss/Netstat/Iptables/Curl)

Tracking Connection Latency with Curl

🧩 The Challenge

Diagnosing whether application slowness is caused by DNS resolution, TCP handshake time, or server-side response delay.

💡 The Fix

Use curl with a custom output format to break down the specific time intervals spent during the various stages of the HTTP request.

curl -so /dev/null -w "DNS: %{time_namelookup}s | TCP: %{time_connect}s | TTFB: %{time_starttransfer}s | Total: %{time_total}s\n" https://www.google.com

⚙️ Why It Works

This command utilizes curl’s write-out parameter to map internal timer variables into a human-readable summary, effectively isolating where latency is introduced in the network stack.

🚀 Pro-Tip: Append -v to the command if you need to see the raw request and response headers in addition to the timing metrics.

Linux Tips & Tricks | © ngelinux.com | 7/10/2026

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted