Loading the journal
Loading the journal
Interview prep
Interview-prep notes anyone can read, maintained by Srujan Chidarla in srujanchidarla/dsa-problems. Pushes to that repo show up here automatically.
Study notes
Interview prep for distributed systems and design tradeoffs.
Chronological notes from the interview-prep program. Phase 1: fundamentals (client-server, load balancers, caching, SQL vs NoSQL, CAP). Later phases: HLD progressions and LLD/OOD.
Every web app is a conversation: client (browser/app) asks, server answers.
One server dies or gets slow — you need many. A load balancer sits in front and spreads requests.
Rule of thumb: if a box can die, put two of it behind a load balancer.
Don't recompute what you already know. Cache at every layer:
| Layer | What lives there | Example |
|---|---|---|
| Browser | Static assets | Cache-Control headers |
| CDN | Images, JS, CSS near users | CloudFront, Cloudflare |
| App | Hot DB rows, sessions | Redis, Memcached |
| DB | Query results | Built-in query cache |
Two patterns that cover 90% of interviews:
And the two hard questions: eviction (LRU when full) and invalidation (TTL expiry is the honest default — "there are only two hard things in CS: cache invalidation and naming things").
| SQL (Postgres, MySQL) | NoSQL (Mongo, Dynamo, Cassandra) | |
|---|---|---|
| Schema | Fixed, enforced | Flexible |
| Scaling | Vertical first, harder horizontal | Built for horizontal |
| Joins | Yes, powerful | Denormalize instead |
| Best for | Money, orders — correctness matters | Feeds, sessions, huge write volume |
Interview default: start SQL (you know your data), move to NoSQL when a specific scale pain forces it. Never start with "we'll use Cassandra" for a todo app.
When the network splits (and it will), you pick two:
So the real choice is CP vs AP: bank ledger → CP (refuse rather than lie); social feed → AP (show something slightly stale, sync later). Most interview answers: "AP with eventual consistency, except the money part."
Next: Phase 2 — a full HLD walkthrough (TinyURL), then LLD/OOD patterns.