How it works
Each guide covers one system or technique: the problem it solves, how it works, where it goes wrong, and which software uses it. There are 44 of them. Where a topic has a simulator, the guide links to it so you can try the idea yourself.
- Find the server’s IP address Guide: DNS
- Open a connection to it Guide: TCP
- Agree on keys and check the certificate Guide: HTTPS and TLS
- Send the request Guide: HTTP
- Choose one of many servers Guide: Load balancing
- Answer from a cache if possible Guide: Caching
- Otherwise, find the row in the database Guide: Database indexing
Networking and the web
How a browser finds a server, connects to it securely and exchanges data.
- A web request, end to end
- How the internet was built, then everything between typing a URL and seeing the page.
- DNS
- How a name is resolved, from your resolver out to the root servers, and the main record types. Simulator
- HTTPS and TLS
- The TLS 1.3 handshake, certificates and chains, SNI, ALPN and mutual TLS.
- SNI
- How one IP address serves many certificates, and how Encrypted Client Hello hides the name.
- WebSockets
- The HTTP upgrade, the frame format, keepalives and running WebSockets on many servers.
- Real-time communication
- Polling, long polling, server-sent events, WebSockets and WebRTC compared.
- Content delivery networks
- Points of presence, anycast routing, cache keys and shielding the origin. Simulator
- NAT
- How NAT shares one public address, and how STUN, TURN and ICE get through it.
- BGP
- How networks on the internet announce routes to each other and choose paths.
- VPC networking
- Subnets, route tables, gateways and peering in AWS, Google Cloud and Azure. Simulator
Running a service at scale
The pieces between the internet and your application servers.
- Load balancing
- Layer 4 and layer 7 balancers, balancing algorithms, health checks and session affinity. Simulator
- Reverse proxies
- How NGINX, Envoy and HAProxy terminate TLS, route requests and balance load.
- API gateways
- What a gateway does with each request: authentication, rate limits, routing and logging.
- Caching
- Caches in the browser, the CDN, the application and the database, and how to keep them correct. Simulator
- Autoscaling
- Scaling pods and nodes in Kubernetes, which metrics to use, and the delay before new capacity arrives. Simulator
- Service discovery
- How services find each other with DNS, registries such as Consul and etcd, or a service mesh.
- Message queues
- Delivery guarantees, acknowledgements, ordering and dead-letter queues.
Databases and storage
How data is found quickly, written safely and kept consistent.
- Database indexing
- B-tree and hash indexes, composite and covering indexes, and the leftmost-prefix rule. Simulator
- Transactions and ACID
- Atomicity, consistency, isolation and durability, the SQL isolation levels and MVCC. Simulator
- Write-ahead logging
- Why databases write a log before changing data, checkpoints, group commit and ARIES. Simulator
- Hash tables
- Hash functions, chaining and open addressing, load factor and resizing.
- Redis persistence
- RDB snapshots, the append-only file, fsync settings and rewriting the log.
- Kafka
- Topics, partitions, replication and consumer groups.
- Kafka storage
- How a partition is stored as segment files, indexed by offset, retained or compacted.
Distributed systems
Keeping copies of data on several machines in agreement.
- Raft consensus
- How a cluster elects a leader and keeps a replicated log consistent. Simulator
- Cassandra replication
- Leaderless replication on a hash ring: consistency levels, hinted handoff and read repair. Simulator
- Distributed IDs
- UUID, ULID, Snowflake and KSUID: their layouts, ordering and collision risk.
Runtimes and memory
How programs schedule work and manage memory.
- Event loops
- How JavaScript and Node.js run many tasks on one thread with queues and callbacks. Simulator
- Thread pools
- Sizing a pool, bounded queues, work stealing and what to monitor.
- Go channels
- Buffered and unbuffered channels, select, and common patterns. Simulator
- Garbage collection
- How collectors find unreachable memory: mark and sweep, generations and concurrent collection.
- Memory allocation
- The stack and the heap, fragmentation, free lists and allocators such as jemalloc. Simulator
- Ring buffers
- Fixed-size circular queues for one producer and one consumer, as in the LMAX Disruptor and io_uring.
Containers and Kubernetes
What a container is and how Kubernetes runs and connects them.
- Containers
- What a Linux container is: namespaces and cgroups put together by an OCI runtime. Simulator
- Kubernetes pod creation
- Every step from kubectl apply to a running container.
- Kubernetes networking
- Pod networks, Services, kube-proxy, CNI plugins, CoreDNS and Ingress.
Sign-in and authorization
Letting one service act on a user’s behalf, and proving who the user is.
- OAuth 2.0
- The authorization code flow with PKCE, client credentials, scopes and refresh tokens.
- OpenID Connect
- How OIDC adds sign-in to OAuth: the ID token, claims, discovery and signing keys.
Algorithms and tools
Graph algorithms, and how Git stores history.
- Shortest paths
- Dijkstra's algorithm, A*, Bellman-Ford and Floyd-Warshall, and when to use each. Simulator
- Maximum flow
- Ford-Fulkerson, augmenting paths and the max-flow min-cut theorem.
- Git internals
- Blobs, trees and commits, the commit graph, packfiles and the reflog.