Measure HTTP request timing

Read-only
What do risk levels mean?
Read-only
Inspects state without changing anything.
Low risk
Reversible with a routine follow-up command.
Medium risk
Changes state; undo path documented.
Destructive
Deletes or overwrites; confirmation required.

Breaks down how long an HTTP request spends in DNS lookup, TCP connect, TLS handshake, and time to first byte, to pinpoint where latency comes from.

networkhttplatencyperformance

Parameters

Full URL to measure, including the scheme.

Commands

Print per-phase timings for a single request

curl -sS -o /dev/null -w "dns=%{time_namelookup}s connect=%{time_connect}s tls=%{time_appconnect}s ttfb=%{time_starttransfer}s total=%{time_total}s\n" <url>

Verification

curl -sS -o /dev/null -w "total=%{time_total}s\n" <url>

Timing values are printed; a large gap between connect and ttfb points at slow server processing rather than the network.

Undo

Not undoable

This recipe only sends a request and changes nothing locally.

Pitfalls

  • A single sample is noisy; run it several times and compare, since DNS caching makes later runs faster than the first.
  • High dns time with fast connect suggests a resolver problem; high ttfb with fast connect suggests a slow backend.
  • On Windows PowerShell, use curl.exe with -o NUL (as in the Windows step, and for the verification command too) — bare "curl" is an alias for Invoke-WebRequest.

Related