A series in 12 parts

From Wi-Fi to
Route Handler

There is a half of networking that no one teaches application developers: the half that happens on one machine. Not routing, not DNS, not what happens to a packet in flight — what happens in the few microseconds between a signal arriving at a network card and a function running in your server.

  1. Wire
  2. NIC
  3. Kernel
  4. Socket
  5. Event loop
  6. Handler

This series builds that picture from the bottom up, one layer at a time, and never asks you to take a layer on faith. The goal is not completeness. The goal is a model good enough to reason with — to look at a latency spike, a dropped connection, or a strange read() and know where on the path to look.


The argument

Six ideas do almost all the work

Everything in the series hangs off these. Hold them, and most of the specifics can be re-derived rather than memorised — which is the difference between knowing the stack and being able to think with it.

  1. 01

    Queues

    Every boundary between two things is a queue, and every queue is finite. Most questions reduce to which one filled up.

  2. 02

    Contexts

    Work happens in execution contexts you do not control, asynchronously with your code. Always ask who is running right now.

  3. 03

    Ownership

    Buffers have owners. A handoff is a transfer of ownership; a copy is what happens at a trust boundary.

  4. 04

    Demultiplexing

    Read a header, decide who gets this, strip it, pass it up. The NIC and your router table are doing the same move.

  5. 05

    Backpressure

    Every stage can say slow down, and each layer says it differently. Confusing behaviour is usually two of them interacting.

  6. 06

    Framing

    Packets are destroyed on the way up. The stream is an illusion, and re-finding the message boundaries is your job.


The series · 12 of 12 published

Four acts, told in order

Post one tells the whole journey badly. Everything after it goes back and fixes one thing that post one got wrong.

Act 0The Map

The whole journey once, simplified to the point of being slightly false — and a list of the lies it tells.

  1. The Whole Journey, Told Once, Slightly Wrong

    Every stage from the wire to your route handler, simplified to the point of being false — and a list of the falsehoods.

    “What actually happens between the request leaving the network and my function running?”

    Read

Act IThe Machine Underneath

Two ideas application developers have never needed: who is running this code, and who owns this memory.

  1. Who Is Running This Code?

    Hardware interrupt, softirq, kernel thread, your process — and what "the kernel handles it for you" actually means.

    “If my code is not running, who is doing the work?”

    Read
  2. Memory Two Things Can Touch

    DMA, ring buffers, descriptors, and the rule that explains every copy in the stack: buffers have owners.

    “Who owns this buffer right now, and what does handing it over cost?”

    Read

Act IIArrival

From a voltage on a pair of wires to bytes sitting in a queue with your socket’s name on them.

  1. The Wire and the NIC

    From a voltage on a pair of copper wires to a frame in RAM, and everything the card decides without asking the CPU.

    “How does a signal become bytes, and how much of that is the CPU's problem?”

    Read
  2. How the Kernel Finds Your Socket

    Demultiplexing as the same move repeated: read a header, decide who gets this, strip it, pass it up.

    “Ten thousand connections arrive on port 443 — how does each one reach the right place?”

    Read

Act IIIThe Stream Illusion

Where packets stop existing, why framing becomes your problem, and how your process gets woken up.

  1. TCP Is a Lie Your Kernel Tells Beautifully

    Where packets stop existing, why a read can return one and a half requests, and how the receive window pushes back.

    “Why is framing my problem if TCP already guarantees ordering?”

    Read
  2. Waiting Without Wasting

    How your process gets woken: blocking reads, readiness with epoll, completion with io_uring, and the last link from the NIC to your event loop.

    “What is my event loop actually doing while it waits?”

    Read
  3. Your Handler, At Last

    Bytes in a buffer become a parsed request and a function call — and the anticlimax is the point.

    “How much of "handling a request" is actually my framework doing something?”

    Read

Act IVDeparture & Payoff

Sending is not receiving in reverse — and every failure you have ever seen, explained by one picture.

  1. Sending Is Not Receiving in Reverse

    Your write returns before anything leaves the machine. What happens after it returns is where the latency lives.

    “My write returned instantly — so why did the client wait forty milliseconds?”

    Read
  2. Where the Model Bends

    Containers, TLS, QUIC, and kernel bypass — four places the picture changes, and how to re-derive it each time.

    “Does any of this still hold inside a container, or over QUIC?”

    Read