Backend · intro

HTTP Lifecycle

DNS → TCP/TLS → request → response: status codes, headers, keep-alive.

backendhttp

Mental model

An HTTP request is a journey: resolve DNS, open a TCP connection, negotiate TLS, send the request, the server routes and responds, the connection is reused or closed. Latency and failures hide in each hop.

How to study HTTP Lifecycle

Begin by restating the mental model in your own words, then connect it to a concrete system you have built or operated. Name the mechanism, the constraint it addresses, and the trade-off it introduces. Use MDN — An overview of HTTP to check details, but close the source before writing your explanation. Retrieval is the learning step; rereading is only preparation.

Next, compare HTTP Lifecycle with API Design, Caching. Ask what changes in correctness, latency, resource use, operability, and failure recovery. Complete Idempotent POST retry and preserve the command, input, output, and one failed attempt as evidence. Finish by explaining the idea without jargon to someone who has not studied the track.

Proof of understanding

  • Explain the mechanism from first principles and identify the state it reads or changes.
  • Give one situation where the concept is the right choice and one where it is not.
  • Predict a realistic failure mode before running the drill, then compare the prediction with evidence.
  • Connect the result to a roadmap or build artifact instead of treating the concept as isolated trivia.

Where it matters

Every web service; the substrate under API design.

Common mistakes

  • Confusing 401 (unauthenticated) with 403 (unauthorized)
  • Ignoring connection reuse and paying TLS cost per request
  • Treating all 5xx as retryable and all 4xx as not

Learn from primary sources

Practice and explain it back

Idempotent POST retry

POST returns 503 after 30s. Client retries. Safe without Idempotency-Key? When is 409 vs 200 on duplicate?

Expected evidence: Unsafe without key; Idempotency-Key makes retry safe; duplicate returns cached 200.

Open the interactive drill →

Review prompts

  • What is the difference between HTTP 401 and 403?

Build evidence

Use a roadmap capstone to turn this concept into working evidence.

Prerequisites

None assigned yet.

Related concepts

Learning paths