← Home ← Codex ← DEBT ← Engine
Browse by Category
+ added · updated 7d
← Back to glossary

HTTP Request-Response Cycle

Networking Intermediate
debt(d7/e5/b5/t7)
d7 Detectability Operational debt — how invisible misuse is to your safety net

Closest to 'only careful code review or runtime testing' (d7). The detection_hints indicate tools like webpagetest, lighthouse, and chrome-devtools are needed, and automated detection is explicitly marked 'no'. The code_pattern notes high TTFB without distinguishing which phase is slow — this requires manual profiling and interpretation, not automated flagging.

e5 Effort Remediation debt — work required to fix once spotted

Closest to 'touches multiple files / significant refactor in one component' (e5). The quick_fix describes understanding a multi-phase cycle and remediating common_mistakes such as enabling Keep-Alive, HTTP/2, DNS TTL tuning, and TLS session resumption — each is a separate configuration or infrastructure change. Together they span multiple systems (DNS, TLS config, server config), making this more than a one-line fix but not a full architectural rewrite.

b5 Burden Structural debt — long-term weight of choosing wrong

Closest to 'persistent productivity tax' (b5). The term applies to all web and API contexts, meaning every developer working on performance, latency, or infrastructure must understand these hidden phases. Misunderstanding imposes ongoing drag across multiple workstreams (CDN decisions, TLS config, DNS management, HTTP version upgrades) but does not single-handedly define the system's shape.

t7 Trap Cognitive debt — how counter-intuitive correct behaviour is

Closest to 'serious trap' (t7). The misconception field explicitly states developers believe 'HTTP requests are instant' — the obvious mental model ignores DNS, TCP, and TLS round trips entirely. This contradicts how developers reason about server-side latency (e.g., conflating TTFB with PHP processing time), a meaningful contradiction with a common analogous concept, warranting t7.

About DEBT scoring →

Also Known As

HTTP lifecycle request lifecycle connection lifecycle

TL;DR

The complete lifecycle of an HTTP request — DNS resolution, TCP connection, TLS handshake, request transmission, server processing, and response delivery.

Explanation

Full cycle: (1) DNS resolution — browser checks cache, then recursive resolver, then authoritative nameserver; (2) TCP connection — SYN/SYN-ACK/ACK three-way handshake; (3) TLS handshake — certificate exchange, key agreement (adds 1-2 RTTs); (4) HTTP request sent — method, headers, body; (5) Server processing — nginx receives, forwards to PHP-FPM via FastCGI, PHP executes, returns response; (6) Response delivery — status, headers, body; (7) Connection reuse via Keep-Alive for subsequent requests. Total time: 50-500ms for a typical dynamic PHP page.

Common Misconception

HTTP requests are instant — each request involves multiple network round trips (DNS + TCP + TLS) before a single byte of application code runs; these are the hidden latency costs optimised by CDN edge nodes.

Why It Matters

Understanding the full request cycle explains why a CDN reduces latency (eliminates DNS + TCP + TLS round trips to distant origin), why preconnect hints help, and where time is actually spent on each page load.

Common Mistakes

  • No HTTP Keep-Alive — establishes a new TCP connection per request.
  • No DNS TTL tuning — low TTL causes DNS resolution on every request.
  • Not using HTTP/2 — multiplexes multiple requests on a single connection.
  • TLS session resumption disabled — requires full TLS handshake on every connection.

Code Examples

✗ Vulnerable
// Every request pays full connection cost:
// User request → DNS (50ms) → TCP SYN (30ms) → TLS (60ms)
// → request (10ms) → PHP (100ms) → response (20ms)
// Total: 270ms before user sees content

// Connection: close header — no reuse:
header('Connection: close');
✓ Fixed
// Optimised request cycle:
// DNS: preconnect + long TTL (300s)
<link rel="preconnect" href="https://api.example.com">

// nginx: HTTP/2 + TLS session tickets + Keep-Alive:
listen 443 ssl http2;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
keepalive_timeout 65;

// CDN edge: user connects to nearby PoP
// → edge serves cached or proxies to origin once
// User sees: 30ms (cached) or 100ms (dynamic)

Added 16 Mar 2026
Edited 22 Mar 2026
Views 140
Rate this term
No ratings yet
🤖 AI Guestbook educational data only
| |
Last 30 days
0 pings S 0 pings M 0 pings T 0 pings W 0 pings T 0 pings F 0 pings S 0 pings S 0 pings M 1 ping T 0 pings W 0 pings T 1 ping F 0 pings S 0 pings S 0 pings M 0 pings T 0 pings W 1 ping T 3 pings F 0 pings S 0 pings S 0 pings M 0 pings T 0 pings W 2 pings T 1 ping F 2 pings S 1 ping S 0 pings M
No pings yet today
Bing 1
Amazonbot 20 Scrapy 14 SEMrush 10 Perplexity 8 Ahrefs 8 ChatGPT 7 Google 7 Unknown AI 5 Bing 5 Meta AI 2 Twitter/X 2 Brave Search 2 Applebot 2 Majestic 1
crawler 87 crawler_json 3 your_contextpost 1 pre-tracking 2
🧱 FUNDAMENTALS — new to this? Start with the ground floor.
HTTP general HTTP (Hypertext Transfer Protocol) is the set of rules that web browsers and servers use to send and receive web pages, images, and data over the internet.

HTTP is the foundation of all web communication. Whether you're building APIs, debugging slow pages, or securing user data, you're working with HTTP concepts daily.

💡 When debugging web issues, always check the Network tab in browser DevTools to see the actual HTTP requests and responses being exchanged.

Ask Codex about HTTP →
Response general A response is the data a server sends back after receiving a request, containing the information or result the client asked for.

Every web interaction depends on responses. Understanding their structure helps you debug why pages fail, build APIs correctly, and control exactly what users receive.

💡 Always set headers before any echo or HTML output—headers must come first.

Ask Codex about Response →
DEV INTEL Tools & Severity
🔵 Info ⚙ Fix effort: Medium
⚡ Quick Fix
Understand the full cycle: DNS → TCP handshake → TLS handshake → HTTP request → PHP processes → response; TTFB reflects PHP processing time, LCP reflects total page load
📦 Applies To
any web api
🔗 Prerequisites
🔍 Detection Hints
High TTFB without understanding which part is slow; no measurement distinguishing DNS vs TCP vs PHP processing time
Auto-detectable: ✗ No webpagetest lighthouse chrome-devtools
⚠ Related Problems
🤖 AI Agent
Confidence: Low False Positives: High ✗ Manual fix Fix: Low Context: File


✓ schema.org compliant