Blog
Notes on data structures & algorithms, system design, and things I learn along the way.
Learning DSA? Follow the structured path — ordered articles from recursion to dynamic programming.→Save the row, then publish the event. Two writes, no shared transaction, and a window where one succeeds and the other doesn't. Why no ordering fixes it, and what does.
Logs tell you what one service did. Metrics tell you that something is slow. A trace tells you where the time went across every service a single request touched.
A lease can expire while the client that holds it is still running. Why process pauses break mutual exclusion, what fencing tokens fix, and when you shouldn't be using a lock at all.
A queue deletes a message when it's handled; a log keeps it and tracks who has read how far. That one difference decides replay, fan-out, ordering, and how you debug a bad deploy.
When a dependency is down, the worst thing you can do is keep waiting for it. Three states, the thresholds that matter, and how a breaker stops one slow service from taking down everything upstream.
A naive retry loop is a denial-of-service attack you wrote yourself. Exponential backoff, why jitter matters more than the backoff, idempotency, and retry budgets.
Replication copies the same data; sharding splits different data. What each one actually buys you, how routing and failover behave, and the problems sharding creates that you have to live with.
Adding a cache in front of a database is easy. Deciding when the cache gets populated and how writes stay consistent with the source of truth is where cache-aside, write-through, write-back and refresh-ahead diverge. Plus the stale-read race in cache-aside, TTLs, eviction policies, cache layers, and how to tell whether a cache is working.
Every distributed database quietly picks a side in a trade-off it can't escape: when the network partitions, you serve either possibly-stale data or an error. What CAP actually says, PACELC and the latency cost the rest of the time, the spectrum of consistency models, quorums, and how eventually consistent replicas converge.
A probabilistic data structure that answers set-membership queries in constant space by allowing false positives but never false negatives — and why Chrome, Cassandra, and CDNs all rely on that trade.
47 posts tagged System Design · page 4 of 5