Articles
System design, one idea at a time
Short references for the numbers and building blocks that come up in every design.
Latency numbers every engineer should know
Rough timings for memory, SSD, network and cross-region calls, and how to use them to see where a request spends its time.
3 min read
Powers of two and back-of-the-envelope estimation
The handful of constants and the method for sizing storage, traffic and bandwidth in your head, with worked examples for a URL shortener.
3 min read
HTTP redirects, 301 vs 302, and how to count every click
What each 3xx status means, which ones browsers cache, and why a link shortener that must count clicks answers with a 302.
3 min read
Base62 short codes and how URL shorteners make keys
How base62 encoding works, how long a code needs to be, and why a counter beats hashes and random strings for collision-free short links.
3 min read
Caching and async queues keep the hot path fast
How a read-through cache takes load off the database, how to keep it fresh, and how a queue moves slow work out of the request.
3 min read
What happens when you open a short link
The full path of one click, from DNS and TLS through the load balancer, cache and database to the redirect, with where the time goes.
3 min read
Load balancers and how they spread traffic across servers
What a load balancer does, layer 4 vs layer 7, the common algorithms, health checks, and how to size a fleet that survives losing a server.
3 min read
Rate limiting with token buckets, windows and one place to count
How rate limiters decide who gets through, the four common algorithms and their trade-offs, and why the count has to live in one shared place.
3 min read
Caching strategies, or what goes in, what stays and when it leaves
Write patterns, eviction policies and cache layers. How to choose what a cache holds and how to keep it from serving stale or lost data.
3 min read
Object storage and CDNs for storing blobs and serving them fast
Why large blobs belong in object storage rather than the database, how a CDN serves them from near the reader, and which cache headers make it work.
3 min read
News feeds, fan-out and the celebrity problem
How a social feed decides when to do its work, why celebrities break the usual answer, how big the feed cache gets, and how to page through it.
4 min read
WebSockets, acks and delivering every chat message
How chat apps keep a live connection to every phone, keep messages in order, confirm delivery, catch up after being offline and route between servers.
4 min read
Notification pipelines that send each push once, on time
How a push gets from an event to a phone through a queue and workers, and how retries, dedupe ids, priorities, limits and quiet hours keep it polite.
4 min read
Flash sales without overselling
Why read-then-write sells the same seat twice, how one conditional update stops it, and how holds and a waiting room get a ticket sale through its first minute.
3 min read
Autocomplete with tries and precomputed top results
How search suggestions come back in milliseconds, how much traffic every keystroke makes, and how the trie is rebuilt, kept fresh and split across servers.
3 min read
Event streams and Kafka, with a metrics pipeline as the example
How a durable log like Kafka sits between the systems that produce data and the ones that use it, plus partitions, consumer groups, delivery guarantees, rollups and label cardinality.
4 min read
Sharding and consistent hashing
How to split a database across many machines. Hash and range sharding, choosing a shard key, consistent hashing, hot shards, cross-shard queries and moving data without downtime.
4 min read
Collaborative editing with operational transforms and CRDTs
How editors like Google Docs let many people type at once. Operational transforms, CRDTs, why a server puts edits in order, presence, and storing a log plus snapshots.
3 min read
Leaderboards with sorted sets
Why rank queries are slow in SQL and fast in a sorted set, how to show the top players and your neighbours, and how to handle seasons, regions, ties and memory.
4 min read
Running in more than one region
Active-passive and active-active, RPO and RTO, replication lag and reading your own writes, failing over with DNS, and what to do when two regions write the same data.
4 min read
Job schedulers, leases and running a job exactly once (almost)
How a job scheduler hands work to a fleet of workers, uses leases and heartbeats to survive crashes, runs cron once across many nodes, and retries safely.
4 min read
File sync with chunks, hashes and conflicted copies
How Dropbox-style sync splits files into chunks, stores each chunk once, sends only what changed, and keeps both versions when two devices edit offline.
4 min read
Sagas, stock holds and checkout that survives a sale
How a checkout spread across services stays correct with sagas and compensating steps, holds stock without overselling, and absorbs a rush with a queue.
4 min read
Event sourcing, or storing what happened instead of what is
How an append-only log of events becomes the source of truth, how to derive current state from it, and how to handle late, repeated and out-of-order events.
3 min read
What famous outages teach about blast radius, rollouts and backups
Seven well-documented outages, from S3 to CrowdStrike, and the lessons their public write-ups share about staged rollouts, tested backups and safer tools.
5 min read
Unique ID generation, from auto-increment to Snowflake
How big systems hand out ids that never repeat and sort by time without a central counter, the bit math behind Snowflake ids, and what to do when a clock goes backwards.
4 min read
Video streaming with bitrate ladders, segments and adaptive bitrate
How a streaming service turns one upload into many versions, cuts them into segments a player can switch between, and serves them through a CDN, with the math for bandwidth and storage.
4 min read
Geospatial indexes with geohashes and quadtrees
How ride-sharing and delivery apps find what is nearby fast, using geohashes and quadtrees, why you search neighboring cells, and how to keep fast-moving locations in memory.
4 min read
Web crawlers, the URL frontier and crawling politely
How a crawler fetches billions of pages without hammering any one site, how it avoids fetching or storing the same thing twice, and how it stays out of traps.
4 min read
Idempotency keys and double-entry ledgers for payments
How payment systems charge exactly once despite retries and timeouts, record every cent in a double-entry ledger, reconcile with the provider, and keep card numbers off their servers.
3 min read
Database transactions, locks and never selling the same room twice
Why check-then-insert races, what isolation levels do and don’t stop, and when to reach for a unique constraint, a conditional update, a row lock or a version number.
4 min read
Pub/sub and fan-out for live chat
How one chat message reaches every viewer across many WebSocket gateways, why the work grows with the square of the audience, and how big rooms stay readable.
3 min read
Serving language models on GPUs
Prefill and decode, why batching multiplies throughput, how the KV cache caps a batch, prefix caching, and how to size and scale a GPU fleet.
4 min read
Order books and matching engines
How an exchange pairs buyers with sellers by price and then time, why each stock gets one single-threaded engine, and how a sequenced log makes crashes recoverable.
4 min read
A design review checklist for the flaws that hurt first
Single points of failure, retries without idempotency keys, cached prices, hot shard keys, retry storms, check-then-act races and dual writes, with the usual fix for each.
4 min read
Time zones, clocks and traffic peaks you can see coming
Why midnight arrives as a string of spikes, why you store zone names instead of offsets, how a page corrects a wrong clock, and how to pre-scale for a spike you know is coming.
4 min read