FullStack AI Hub
Studio
System Design · 01. Foundations
10 min
10 steps
Beginner

Networking & HTTP

Compare TCP + TLS 1.3 handshakes, keep-alive pooling, HTTP/2 stream multiplexing, and HTTP/3 QUIC over lossy mobile networks.

System Design01. FoundationsLesson 3 of 3
10 minBeginner10 steps

Networking & HTTP

Compare TCP + TLS 1.3 handshakes, keep-alive pooling, HTTP/2 stream multiplexing, and HTTP/3 QUIC over lossy mobile networks.

SETUP COST
2 RTT (160ms)
PROTOCOL
TCP + TLS 1.3
NEW CONNS/S
1,800/s
TLS CPU
62%
SYN + ClientHelloHTTP payloadBrowserTLSTerminator62%TCP+TLS = 2 RTTApp Origin42%
HTTP stream / packet
handshake / HOL stall
TLS / QUIC 0-RTT
packet loss / reset
In This LessonStep 1 of 10
What You Will Master
  • ✓Measure TCP 3-way + TLS 1.3 handshake RTT overhead and eliminate it with Keep-Alive connection pooling
  • ✓Resolve HTTP/1.1 head-of-line blocking using HTTP/2 binary framing and multiplexed streams
  • ✓Diagnose why packet loss stalls all HTTP/2 streams on TCP and how HTTP/3 (QUIC) fixes it over UDP
  • ✓Leverage QUIC 0-RTT resumption and Connection ID migration for seamless mobile Wi-Fi-to-5G handoffs

Architectural Trade-Off Comparison Matrix

PatternBest ForKey Trade-Off
HTTP/1.1 + Keep-AliveLegacy proxies and simple internal REST servicesApp-layer HOL blocking; browsers open 6 parallel TCP sockets per host
HTTP/2 (over TCP)Multiplexed APIs, gRPC, and clean wired broadband trafficSingle dropped TCP packet stalls every multiplexed stream together
HTTP/3 (QUIC / UDP)Mobile apps, global edges, and lossy cellular/Wi-Fi networksSlightly higher CPU encryption cost; some corporate firewalls block UDP 443
Edge TLS TerminationCutting handshake RTT from 180 ms to 20 ms worldwideRequires trusted edge PoPs + persistent origin connection pools

Step-by-Step Architectural Breakdown (10 Steps)

Full architectural walkthrough transcript and state transitions for Networking & HTTP.

STEP 01 · SETUPJump to step →

Cold connections pay TCP + TLS handshake RTTs

Opening a brand-new HTTPS connection is surprisingly chatty: **TCP’s 3-way handshake** (`SYN → SYN-ACK → ACK`) costs **1 full RTT**, and **TLS 1.3 encryption negotiation** adds **1 more RTT** (2 RTTs on older TLS 1.2).

Over an **80 ms transatlantic link**, a user waits **160+ ms** before the server even sees `GET /api/feed`—and TCP Slow Start restricts initial packet volume further!

idea:TLS 1.3 trimmed a full round-trip off TLS 1.2, cutting handshake latency by 33–50% across the entire web.

TCP 3-Way HandshakeTLS 1.3 (1-RTT)TCP Slow Start
STEP 02 · SOLUTIONJump to step →

Reuse warm sockets with Keep-Alive Connection Pools

Instead of tearing down TCP sockets after every response, **`Connection: keep-alive`** keeps warm sockets open in a **Connection Pool**. Subsequent requests reuse an already-encrypted, fully warmed TCP congestion window.

Setup overhead drops to **0 ms** on 95% of requests, cutting TLS CPU by **80%** and shaving 140 ms off repeat API calls.

good:Always enable HTTP Keep-Alive between microservices too—re-handshaking TLS on every internal RPC wastes huge CPU and latency.

HTTP Keep-AliveConnection PoolingWarm Congestion Window
STEP 03 · PROBLEMJump to step →

HTTP/1.1 Head-of-Line (HOL) Blocking

On an **HTTP/1.1** connection, responses must return strictly one at a time in order. If request #1 (`hero-bundle.js`) is slow, requests #2–#20 sit stuck waiting behind it—**Application-layer Head-of-Line Blocking**.

Browsers hacked around this by opening **6 parallel TCP connections per domain** (burning 6× handshakes and memory), yet modern pages fetching 60 assets still queue badly.

watch:Domain sharding (`img1.`, `img2.`, `img3.`) was an old HTTP/1.1 workaround—under HTTP/2 it actually HURTS performance by breaking multiplexing.

HTTP/1.1 Pipelining FlawApp-Layer HOL Blocking6-Connection Limit
STEP 04 · SOLUTIONJump to step →

HTTP/2: binary framing & multiplexed streams

**HTTP/2** slices messages into tiny tagged **binary frames** and interleaves **100+ concurrent streams** over a **single TCP connection**. Fast CSS and API calls zip past a slow large image without waiting!

It also adds **HPACK header compression**, shrinking repetitive 800-byte cookie/auth headers down to a few dozen bytes.

good:One single HTTP/2 connection replaces 6 HTTP/1.1 sockets—eliminating app-layer HOL blocking and powering gRPC streaming.

HTTP/2 MultiplexingBinary FramesHPACK Header Compression
STEP 05 · PROBLEMJump to step →

The hidden HTTP/2 flaw: TCP-level HOL blocking

HTTP/2 solved blocking inside HTTP—yet **all 100 streams still ride inside one single ordered TCP byte stream**. On a shaky subway 4G connection with **2% packet loss**, losing just **1 TCP packet** freezes **all 100 streams**!

The OS kernel refuses to deliver already-arrived packets for Streams #2–#100 until the single lost packet from Stream #1 is retransmitted—sometimes making HTTP/2 **slower than HTTP/1.1** on lossy mobile links.

watch:TCP guarantees strict in-order delivery across the whole socket; it cannot know that Stream #4 is completely independent of lost Stream #1.

TCP-Level HOL BlockingPacket Loss RetransmissionMobile Cellular Jitter
STEP 06 · SOLUTIONJump to step →

HTTP/3 & QUIC: independent streams over UDP

**HTTP/3** replaces TCP with **QUIC**, a modern encrypted transport built on **UDP**. QUIC runs **independent stream buffers in user space**: if a packet for Stream #1 drops, Streams #2–#100 keep delivering immediately with **zero cross-stream blocking**!

Even better, QUIC bakes **TLS 1.3 directly into the transport handshake**, cutting cold connection setup from 2 RTTs down to **1 RTT** (and **0-RTT** on repeat visits).

good:QUIC eliminates TCP HOL blocking AND halves connection setup RTTs—which is why YouTube, Meta, and Cloudflare serve huge shares of mobile traffic over HTTP/3.

HTTP/3QUIC over UDPIndependent Stream Delivery
STEP 07 · TECHNIQUEJump to step →

Connection Migration: walk from Wi-Fi to 5G seamlessly

TCP identifies a connection by the 4-tuple `(Client IP, Port, Server IP, Port)`. The moment you walk out your front door from **Wi-Fi to 5G**, your phone’s IP changes—**killing every active TCP socket** and forcing fresh handshakes.

QUIC instead attaches a cryptographic **64-bit Connection ID** inside every packet header. Even when your IP changes mid-video call, the server matches the Connection ID and keeps streaming without dropping a beat!

good:Connection Migration is a massive real-world win for mobile video, rideshare, and chat apps where users constantly switch towers and Wi-Fi.

QUIC Connection IDConnection MigrationZero-Drop Handoff
STEP 08 · TRADE-OFFJump to step →

0-RTT resumption: instant reconnects vs replay risk

Both TLS 1.3 and QUIC support **0-RTT resumption**: a returning client attaches its first HTTP request inside the **very first packet** using a cached session ticket—zero handshake wait!

The subtle catch: 0-RTT early data is **not protected against network replay attacks**. Only allow **safe, idempotent `GET` requests** on 0-RTT; hold `POST /transfer` until the full 1-RTT handshake completes.

watch:Never execute state-changing mutations (payments, password resets) inside TLS/QUIC 0-RTT early data.

0-RTT Early DataReplay Attack ProtectionIdempotent GET Safety
STEP 09 · TECHNIQUEJump to step →

Edge TLS Termination + HTTP/2 Origin Pools

Rather than forcing mobile phones to negotiate TLS all the way to your central datacenter, **Edge PoPs** terminate **HTTP/3 QUIC** just 15 ms from the user, then forward traffic over **pre-warmed persistent HTTP/2 pools** to the Origin.

Users enjoy local 15 ms handshakes and zero TCP HOL blocking on cellular links, while origins stay simple and calm over stable fiber.

good:HTTP/3 at the chaotic mobile edge + pooled HTTP/2 on clean datacenter fiber is the gold-standard transport stack.

Edge TLS TerminationHTTP/3 Edge + HTTP/2 OriginAlt-Svc Upgrade
STEP 10 · RECAPJump to step →

Modern HTTP transport stack recap

Modern web networking evolved to crush round-trips and head-of-line stalls: **Keep-Alive** stopped wasteful handshakes, **HTTP/2** multiplexed streams over TCP, and **HTTP/3 (QUIC)** moved streams onto UDP with built-in TLS 1.3 and seamless mobile migration.

Run the combined chaos drill below to test UDP firewall fallback under a 1.8× traffic surge.

good:Terminate HTTP/3 + HTTP/2 at nearby Edge PoPs with TLS 1.3, keep warm HTTP/2 pools to origins, and restrict 0-RTT strictly to idempotent GETs.

HTTP/3 + HTTP/2 StackQUIC Edge TerminationGraceful TCP Fallback

Related Production Deep-Dives & Simulators

Included In Free Course
Free · Verifiable Credential

FS-102LLM Systems Foundations

Build a connected mental model from tokens through retrieval evaluation security and operations.

24 concepts~18h self-paced
Start Free Course
Weekly Engineering Dispatch

Get the weekly systems teardown

One technical note per week covering inference bottlenecks, retrieval harnesses, and commit-pinned teardowns.