Pick a depth. Each prompt opens in your AI pre-loaded with the lesson. Click a row to preview the prompt.
These three terms appear on every APM dashboard and SRE runbook, yet engineers use them interchangeably while meaning completely different things. TTFB (Time to First Byte) measures the gap from when the client sends a request to when it receives the first byte of the response — it captures server think-time plus one round-trip of network travel, but excludes how long the body takes to transfer. Turnaround time is the full wall-clock duration from first byte sent to last byte received; it includes TTFB plus body-transfer time. Latency, strictly, is one-way propagation delay; in practice it is used loosely to mean round-trip time or TTFB. Getting these wrong costs you: a 50 KB JSON payload with a 5 ms TTFB and 280 ms transfer time has a 285 ms turnaround — optimising server logic (which affects TTFB) will not help you because the body transfer is the bottleneck.
HTTP responses consist of two distinct durations: TTFB (the server think-time plus one network round-trip) and body transfer (proportional to payload size). Treating them as a single "latency" number masks which half is the bottleneck — a 5 ms TTFB with 280 ms transfer means server-side optimization is wasted effort. Splitting the measurement first tells you exactly where to spend engineering time.
/posts (100-item array) vs /posts/1 (single object) — which number changes: TTFB, transfer, or both? Explain why.https://httpbin.org/delay/0.3 (300 ms artificial server delay) and observe which metric grows — does transfer time change too? Why or why not?https://httpbin.org/bytes/500000 (500 KB) — watch transfer time climb while TTFB holds steady. Calculate roughly: at what body size does transfer time exceed your observed TTFB?// main.go — print TTFB and transfer time separately
package main
import (
"fmt"
"io"
"net/http"
"time"
)
func measure(url string) {
start := time.Now()
resp, err := http.Get(url)
if err != nil { fmt.Println("error:", err); return }
ttfb := time.Since(start)
io.Copy(io.Discard, resp.Body)
resp.Body.Close()
total := time.Since(start)
fmt.Printf("%-55s TTFB %6v transfer %6v total %6v\n",
url, ttfb.Round(time.Millisecond),
(total-ttfb).Round(time.Millisecond),
total.Round(time.Millisecond))
}
func main() {
measure("https://jsonplaceholder.typicode.com/posts") // 100-item array
measure("https://jsonplaceholder.typicode.com/posts/1") // single object
measure("https://httpbin.org/bytes/100000") // 100 KB body
}go run main.go