• ↑↓ to navigate
  • ↵ to open
  • ⟶ to select
  • ⌘ ⌥ ↵ to open in a panel
  • ←→ to navigate
  • esc to dismiss
⌘ '
keyboard shortcuts

The Problem

Why is second API call faster than first?

Formal Definition

Per Wikipedia: “Persistent connections keep TCP/TLS open after response so next HTTP exchange skips handshake — called keep-alive.”

Explanation

Like keeping phone line open — second question does not need redial.

How It Works

  1. First request does TCP+TLS+HTTP
  2. Server replies with Connection: keep-alive
  3. Socket stays open idle
  4. Second request reuses socket
  5. Timeout closes after idle

Visual Explanation

persistent_connections A First Request B Keep-Alive A->B step 1 C Reuse B->C step 2

Semantic Network

semantic_persistent_connections THIS Persistent Connections REL1 Related THIS--REL1 related REL2 Prereq THIS--REL2 builds from

Key Properties

  • Saves 1-2 RTT per reuse
  • Needs idle timeout
  • Head-of-line blocking in HTTP/1.1
  • HTTP/2 multiplexes over one

Real-World Example

Connection: keep-alive

Connections

Edge Cases & Gotchas

  • Leaking sockets — no close on error
  • Pooling without limit — too many open