Networking under failure

TCP retransmits, connection pools, keepalives, DNS TTLs, conntrack exhaustion. Most mystery latency lives between the app and the kernel.

About 29 min read3-question knowledge check

The mental model

The network between two services is not a wire — it is a chain of queues and lookup tables, each with a finite size and its own opinion about when to give up. Socket buffers, qdiscs, NIC rings, conntrack tables, NAT port ranges, load-balancer connection tables, DNS caches: a request crosses a dozen of them, and every one can queue (latency), overflow (loss), or time out (mystery errors) independently.

Why this topic exists as its own discipline: application dashboards end at the socket. When latency or errors originate in the layers between your code and the far end's code, the app logs show nothing, both services look healthy, and the incident channel fills with dependency-blaming. Most "mystery" production latency — the p99 spikes that appear and vanish, the 0.2% connection failures nobody can reproduce — lives in exactly these layers. An SRE who can walk the path mechanically (retransmit counters, conntrack occupancy, backlog depths, DNS timeout behavior) turns days-long ghost hunts into twenty-minute diagnoses.

What breaks without this model, concretely: teams see 5-second latency outliers and tune the application for weeks when the real cause is a dropped SYN retransmitted after exactly 1 second — the TCP handshake's exponential timer leaking into their p99. Or they see intermittent timeouts at traffic peaks and scale out the fleet, while the actual limit was a conntrack table or a SNAT port range that scaling out makes worse. The failure signatures are distinctive — 1s/3s/5s latency modes, "table full" kernel logs, TIME_WAIT pileups — but only if you know them by sight.

The full lesson continues with 15 more sections
  • Deep dive
  • Internal architecture
  • Real-world use cases
  • Best practices
  • Common mistakes
  • Performance
  • Security
  • Production troubleshooting
  • Advantages & disadvantages
  • Alternatives
  • Interview expectations
  • Interview questions
  • Facts to remember
  • Cheat sheet
  • Quick revision