Writing
Blog
Original series articles on design, engineering, and ideas.
76 posts · 7 seriesNothing matches that.
2026
-
Nov 2026
Low-Level Design, Question by Question
Part 1 In low-level design every rule lives beside the state it reads. Find the owners first, and the code follows 29 min Part 2 A design pattern earns its place when the problem already has its shape. Before that, it is ceremony 30 min Part 3 A race condition is a gap between reading a value and writing it back. Every Java concurrency tool closes that gap, waits across it, or rations who gets in 26 min Part 4 A Connect Four win can only run through the disc dropped last, so the board never needs a full scan 22 min Part 5 A parking lot is two strategies around one atomic claim: which spot, what price, and who gets it first 28 min Part 6 A vending machine is a state machine you can touch: every bug in it is a button that works in the wrong state 30 min Part 7 An elevator keeps going the way it is going: the car owns that rule, and the controller only picks which car 30 min Part 8 Amazon Locker is an allocation problem with a deadline: pick the smallest box that fits, and let every code die on time 25 min Part 9 Selling a cinema seat is a race you lose by checking first. Make 'is it free?' and 'it's mine' one step 26 min Part 10 A rate limiter is one small piece of state per caller and a rule for reading it. Get the state right under threads and the algorithm becomes a plug-in 26 min Part 11 An LRU cache is a map that finds and a list that forgets. Make the forgetting a plug-in and the rest of the design follows 30 min Part 12 A log call should cost one comparison when it's off and never block when it's on. The rest of a logging framework is plumbing 31 min Part 13 A file system is one tree and one path walk. Every command is that walk plus a few lines, and Composite keeps them few 30 min Part 14 Splitwise is a ledger that must balance to the last paisa. Splitting the bill is the easy part 27 min Part 15 Stock is not a counter you decrement. It's three numbers, and every order moves units between them in one atomic step 26 min Part 16 A message queue is a log that only grows and one number per consumer group. Every guarantee is a rule about when that number moves 28 min -
Nov 2026
High-Level Design, Question by Question
Part 1 In a 45-minute design round, a plain system that works end to end beats a brilliant one that's half drawn 23 min Part 2 A URL shortener is one key lookup that must survive a hundred readers per writer. The hard part is minting the key. 22 min Part 3 A distributed rate limiter is one shared counter that a hundred servers bump at once. Everything else is deciding how wrong it may be. 22 min Part 4 A file-sync service is a blob store your servers never touch, plus a change log every device reads from a cursor 25 min Part 5 A video site doesn't serve videos. It serves millions of six-second files, and the player picks the next one 23 min Part 6 Selling the same seat twice is the one bug a ticketing system can't have, and a hold with an expiry is how you avoid it 24 min Part 7 Every news feed is built at post time, except for the few accounts whose followers would turn one post into a hundred million writes 23 min Part 8 A chat app is a routing problem: find the one server holding the recipient's connection, and keep the message until the phone says it arrived 21 min Part 9 Uber is two hard problems in one app: a map that rewrites itself every four seconds, and a driver only one rider can win 22 min Part 10 Search is a second copy of your data, filed by word instead of by post, and allowed to run a few seconds behind 23 min Part 11 Top K is a counting problem, not a sorting problem, and the answer is exact only if each video is counted in exactly one place 21 min Part 12 Exactly-once is not something a stream gives you. It's a log you can replay, a key you can deduplicate on, and a batch job that checks the answer 21 min Part 13 A web crawler is a queue with manners, and the manners, not the fetchers, decide how fast it can go 30 min Part 14 A notification can't be unsent, so the design is about the ones you must not send twice and the ones that must not wait 26 min Part 15 A scheduler can't promise to run a job exactly once, so it runs it at least once and makes the second run harmless 27 min Part 16 A payment system is not one charge. It's a state machine that must never move money twice, even when it doesn't know what happened 27 min Part 17 Google Docs never locks a sentence. One server per document puts every edit in order, and every editor shifts what it receives to fit 27 min - Oct 2026 I built a production-grade ledger in Java 21 and Spring Boot 4 where money can't go missing
-
Sep 2026 – Oct 2026
System Design
Part 1 Scale is not a compliment you pay your architecture, it's a number you're supposed to compute 16 min Part 2 The network will partition. That's not a risk you mitigate, it's a fact you design around 15 min Part 3 REST, RPC, gRPC, WebSockets: four answers to a question most API debates never actually ask 14 min Part 4 Your request hits six systems before your code ever sees it, and most designs only account for one 17 min Part 5 An application server is not allowed to remember you, and almost every operational headache traces back to forgetting that 18 min Part 6 Two people try to book the last seat at the same instant, and the answer to who wins is a design decision, not an accident 18 min Part 7 A product catalog and a bank ledger have no business living in the same kind of database 19 min Part 8 Caching is the easy 80%. Knowing when a cached answer is a lie is the hard 20% 15 min Part 9 An order confirmation email should never be the reason a checkout button spins for three seconds 22 min Part 10 Every chat message needs an ID nobody coordinated on, and every request needs a caller nobody can fake 20 min - Sep 2026 I built a production-grade DevOps platform end to end, then broke it on purpose on real AWS
-
Sep 2026
Building a Multi-Tenant Support AI Agent
Part 1 Postgres row-level security for multitenancy, and the leak you build by putting it behind a pooler 13 min Part 2 A job queue in Postgres with FOR UPDATE SKIP LOCKED, and a Redis that's allowed to die 11 min Part 3 MCP as the guardrail: an agent whose only route to a customer is a tool call 12 min Part 4 Calibrating a RAG gate: answer, clarify or escalate, decided by signals retrieval already paid for 12 min Part 5 Evals for an LLM agent that can't grade itself: replayed recordings, Cohen's κ, and a red team in CI 14 min - Sep 2026 I built a webhook delivery engine to learn distributed systems the hard way
2024
-
Feb 2024 – Mar 2024
Data Structures & Algorithms, Pattern by Pattern
Part 1 Following a solution and finding one are different skills. This series trains the second. 16 min Part 2 Most array problems are really asking what you've already seen 44 min Part 3 Two pointers work because one comparison throws away a whole row 21 min Part 4 A stack remembers what you haven't finished. A monotonic stack forgets what can never matter 29 min Part 5 Binary search was never about sorted arrays. It's about a yes/no question that flips exactly once 32 min Part 6 Sliding window is two pointers that never walk backwards 40 min Part 7 Linked lists punish you for letting go of the wrong pointer first 38 min Part 8 Every tree problem asks one question: what does this node need from its children? 52 min Part 9 A trie is every prefix of every word, each one stored exactly once 23 min Part 10 A heap only knows who's first, and that's exactly why it's fast 34 min Part 11 Backtracking is one loop: choose, explore, un-choose 40 min Part 12 Interval problems are a sort plus one number: where the current block ends 29 min Part 13 Greedy is a bet you have to prove: Kadane's algorithm and the arguments that make a local choice safe 32 min Part 14 Every graph problem asks one question first: have I been here before? 54 min Part 15 Dynamic programming is backtracking that finally remembers what it already worked out 39 min Part 16 Dijkstra, Prim and Kahn are one loop asking three different questions 51 min Part 17 Every 2-D DP table is a question with two blanks in it 57 min Part 18 Python integers never overflow. Half the bit problems assume they do. 34 min Part 19 Math & Geometry is five small tricks, and each one breaks on its own edge case 50 min -
Jan 2024
Computer Networking, Layer by Layer
- Jan 2024