CMD Guide
HomeSystem DesignMicroservices Patterns

System Design Examples

Service discovery in real designs (with hostile review)

Use cases alone do not defend a design. Below: where discovery belongs, a traced e-commerce membership change, and a review table that names the first bottleneck, a rejected alternative, and a paid trade-off.

When the pattern earns its keep

Worked example: e-commerce checkout under scale-out

Services: User, Inventory, Cart, Order, Payment. Order calls Inventory and Payment. Payment runs 8 pods. Black Friday HPA adds 12 pods in 90 seconds.

StepWhat happensIf static configWith discovery + health
1HPA launches 12 Payment podsNot in anyone's listPods register; health = ready
2Registry / Endpoints updatesWatchers push new set (or DNS TTL refreshes)
3Order resolves PaymentStill 8 endpoints → overloadLoad spreads across 20
42 old pods drain for deployCallers hit terminating pods → 502/timeoutDeregister + connection draining; removed from set

Numbers: Payment capacity ≈ 500 RPS/pod. Peak need 7,000 RPS → need ≥14 healthy pods. With a stale 8-pod list you run at 4,000 RPS capacity while 12 pods idle — artificial outage with spare hardware.

Streaming platform (discovery + server-side LB)

Video edge pods scale with concurrent viewers. A Control-plane registry (or K8s Endpoints) feeds Envoy/HAProxy. Players never see instance IPs; they hit a stable hostname. Discovery failure mode shifts to: "control plane lag" rather than "client config lag."

Hostile design-review table

System sliceFirst bottleneck under loadRejected alternativeTrade-off you acceptFailure mode to monitor
E-commerce Order→Payment Stale client cache under HPA → timeouts + idle capacity Bake Payment VIP into every Order deploy Registry/DNS as runtime dependency Register lag; % traffic to NotReady endpoints
K8s-native fleet kube-proxy / iptables or IPVS conntrack under huge Service fan-out Custom Eureka per language on every pod Platform coupling; less app-level LB sophistication Endpoint slice storms; DNS NXDOMAIN spikes
Multi-DC with Consul Cross-DC query latency; WAN gossip delays Global anycast to wrong region Stale remote DC members during partition Serf health; prepared queries fallback
Mesh (Envoy xDS) xDS push lag / control plane CPU Each app implements outlier detection alone Sidecar CPU/mem per pod CDS/EDS update age; 503 no_healthy_upstream

Real-world anchors (what they actually run)

When NOT to use a separate discovery product

Operability checklist

Drill ladder

  1. Q: After scale-out, RPS/pod on old pods stays high and new pods near zero for 10 minutes. Root cause class? A: Resolution cache / long DNS TTL / clients not watching registry — not "HPA failed."
  2. Q: Why can two registries (Eureka + K8s Endpoints) be worse than one? A: Conflicting membership; partial updates; harder incident response — pick one source of truth.
  3. Q: Defend server-side discovery for a 40-language fleet. A: One proxy/mesh implements LB and health; apps stay dumb; cost is hop + platform ownership.
🤖 Don't fully get this? Learn it with Claude

Stuck on System Design Examples? Open Claude, copy a block below, and it'll teach you this exact concept — visually and interactively.

🎨 Explain it visually

Build the mental picture, not memorization.

I just read a lesson on **System Design Examples** (System Design) and want to truly understand it. Explain System Design Examples from first principles using ONE vivid real-world analogy and a visual mental model — draw it as ASCII art or a clear step-by-step diagram — with a concrete example using real numbers. Then ask me one question to check I got the mental picture, and wait for my reply. If you're unsure or a claim isn't standard, say so and reason from first principles instead of guessing.
🤔 Walk me through it (interactive)

Socratic — adapts to where you're stuck.

Teach me **System Design Examples** interactively. Ask me ONE guiding question at a time, wait for my answer, and adapt to my confusion — build the idea with me step by step instead of explaining it all at once. If you're unsure or a claim isn't standard, say so and reason from first principles instead of guessing.
🧪 Quiz me & fix my gaps

Active recall exposes what you missed.

Quiz me on **System Design Examples** with 5 questions, easy to tricky, ONE at a time. Tell me if each answer is right; at the end, explain clearly what I got wrong and why. If you're unsure or a claim isn't standard, say so and reason from first principles instead of guessing.
🧠 Make it stick

Intuition + hook + flashcards for long-term memory.

Help me remember **System Design Examples** for the long term: give the one-sentence intuition, a memorable hook/mnemonic, a tiny worked example, and 3 active-recall flashcards (Q -> A). If you're unsure or a claim isn't standard, say so and reason from first principles instead of guessing.

📝 My notes