Lição 03 · Unit 1 · Networking for a Backend Engineer & Application Support

Where Did the Time Go?

"It's slow" is the vaguest ticket in existence. But you already know the four stages every request walks through — so "slow" just means one of them is eating the time. curl -w prints the stopwatch.

Run this (it's in your dev container; -o /dev/null -s hides the body):

curl -o /dev/null -s -w '
namelookup:    %{time_namelookup}s
connect:       %{time_connect}s
appconnect:    %{time_appconnect}s
starttransfer: %{time_starttransfer}s
total:         %{time_total}s
' https://example.com/

Typical output:

namelookup:    0.012s
connect:       0.145s
appconnect:    0.289s
starttransfer: 0.433s
total:         0.434s

The stopwatch is cumulative

Each number is time since the start — so each stage's cost is the gap between neighbors (Cloudflare — A Question of Timing):

time_namelookup
DNS done — stage ① cost, straight up.
time_connect
TCP connected — stage ② cost is connect − namelookup.
time_appconnect
TLS done — stage ③ cost is appconnect − connect.
time_starttransfer
First response byte arrived — the gap after appconnect is mostly the server thinking.
time_total
Last byte arrived — the rest is transfer.

Which timer stops the moment the TLS handshake completes?

namelookup: 0.010s, connect: 0.030s, appconnect: 0.070s, starttransfer: 4.8s. Where did the time go?

Try it on two sites now — one nearby, one overseas — and see which gaps grow. That difference is round-trip time, and it becomes a main character later.

Fonte primária · leia em seguida

Cloudflare — "A Question of Timing" — the canonical walkthrough of curl -w timers and what each phase contains.

Sou seu professor — traga suas perguntas difíceis de “mas por quê”. Exporte seu progresso na página do curso e cole no /teach.

03 / 11Anterior