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.→How to release new versions with minimal risk: rolling updates, blue-green switches, canaries that expose a change to a small share of real traffic first, automated rollback on bad metrics, feature flags that separate deploy from release, and the database migrations that make rollback possible.
How an app like Uber or Ola matches riders with drivers: a high-write location service indexed by geo cell, matching ranked by ETA rather than distance, a trip state machine, live tracking over WebSockets, surge pricing, and the consistency questions behind 'two riders, one driver'.
Designing a crawler that fetches billions of pages politely: the URL frontier with per-host queues, robots.txt and rate limits, DNS caching, de-duplicating URLs with Bloom filters and content with fingerprints, avoiding crawler traps, freshness scheduling, and scaling it all across machines.
How a cluster of hundreds of nodes agrees on who's alive without a central coordinator: each node periodically tells a random peer what it knows, information spreads in about log N rounds, and heartbeats riding along let everyone detect failures. With SWIM, phi accrual detectors, and the trade-offs.
How Dynamo-style databases stay available with replicas that disagree. Choosing how many replicas must confirm a write (W) and answer a read (R) out of N, why R + W > N makes reads see the latest write, and the machinery around it: versions, read repair, hinted handoff and sloppy quorums.
A hot cache key expires, thousands of requests miss at once, and all of them run the same expensive query. How cache stampedes happen, and the fixes: request coalescing, a rebuild lock, serving stale data while revalidating, probabilistic early expiration, and TTL jitter.
Why LIKE '%term%' doesn't scale, and what search engines do instead. Tokenising and normalising text, postings lists with positions, fast AND, OR and phrase queries, ranking with BM25, and how Lucene-style engines keep the index updated with immutable segments.
Opening a database connection costs round trips, TLS and authentication, and every open connection costs the database memory. How a pool reuses a few connections across many requests, how to size it, what happens when it's exhausted, and why serverless and many replicas need an external pooler like PgBouncer.
Designing one-to-one and group messaging like WhatsApp or Slack: persistent connections, presence, message ordering with per-conversation sequence numbers, delivery receipts, offline sync, media, and fan-out for groups. With the trade-offs at each step.
How a social feed shows each person the latest posts from everyone they follow: fan-out on write vs. fan-out on read, the celebrity problem and the hybrid that solves it, feed storage, hydration, ranking, and pagination — with the numbers behind each choice.
47 posts tagged System Design · page 1 of 5