FREE COMPUTER SCIENCE STACK LEVEL · 12 OF 14

Networks & distributed systems

How do independent computers coordinate through failure?

The question this layer answers

How do independent computers coordinate through failure?

Many machines, one service. This layer connects Protocols, Load balancers, Queues, Replication, Consensus to the rest of the computing stack.

Free Networks & distributed systems lessons

1. One request crosses many protocols

DNS, IP, transport, TLS, and HTTP

Naming maps a service name to reachable addresses. IP forwards packets across networks on a best-effort basis. A transport such as TCP provides an ordered byte stream with flow and congestion control; QUIC builds secure multiplexed streams over UDP. TLS authenticates peers and protects bytes. HTTP defines application messages and semantics.

TCP can retransmit lost segments and deliver bytes in order. The server may still reject the request, crash after committing it, or send a response the client never receives. Transport reliability protects a stream between endpoints; application correctness needs operation identity and outcome semantics.

2. Failure is partial and ambiguous

Timeouts, retries, backoff, and overload

The request, server work, or response may have been lost or delayed. Retrying can recover transient failure but may duplicate effects and amplify overload. Deadlines propagate a total time budget; exponential backoff with jitter spreads retry traffic; circuit breakers and admission control protect a struggling dependency.

For a stable system, average concurrency is approximately throughput multiplied by average time in system. At 1,000 requests per second and 200 ms average latency, about 200 requests are in flight. If service capacity falls while arrivals continue, the queue grows and latency rises before outright errors appear.

3. Copies must agree enough

Replication, consistency, ordering, and consensus

Copies receive updates at different times and may be partitioned. A consistency model defines which values and orderings clients may observe. Leader-based replication can serialize writes through one authority; quorum systems overlap read and write sets under specific assumptions; consensus lets a changing group agree on an ordered log despite some failures.

A linearizable operation appears to take effect atomically between call and response, respecting real-time order. Achieving it across replicas requires coordination with an authoritative quorum or leader, which adds latency and can reject work during partitions. Eventual consistency permits more availability but moves conflict and staleness into the application contract.

4. Distributed mastery: shape and observe load

Load balancers, caches, queues, and graceful degradation

Load balancers choose healthy destinations and need a policy for uneven work. Caches trade freshness and invalidation complexity for lower latency and origin load. Queues decouple production from consumption and absorb bursts, but backlog is delayed work, not disappeared work. Bulkheads and degradation preserve critical paths when capacity is scarce.

Cache-aside reads check the cache, load from origin on miss, then populate. On update, deleting the cached value avoids serving a known old copy but races and failures still matter. TTL bounds some staleness; versioned keys or event-driven invalidation strengthen particular workflows. “Use a cache” is incomplete without a freshness contract.

Practise Networks & distributed systems free →