System Design Patterns: From Fundamentals to Real Systems
Vote

0% completed

Pattern Review

  1. How to Use This Lesson
  1. Symptom → Pattern: The Diagnostic Table
  1. The Pattern Index
  1. The Decision Cheat Sheet
  1. Seven Threads That Run Through Everything
  1. The Whiteboard Checklist

1. How to Use This Lesson

This lesson is the course compressed for review: every pattern in one line, every big decision in one sentence, and a diagnostic table that maps symptoms back to patterns. It does not replace the lessons. Each one-liner links back to its lesson, where the full walkthrough, the numbers, and the TL;DR card live.

Three ways to use it:

  1. The night before an interview: read sections 2 through 5 top to bottom (about 15 minutes), then run one capstone actively.
  2. During design work: use section 2 as a lookup: find your symptom, follow the link.
  3. As a self-test: cover the right-hand column of any table and reconstruct it. Any row you cannot fill in is your study list.

2. Symptom → Pattern: The Diagnostic Table

Every lesson in this course opened with a system on fire, because recognizing shapes from symptoms is the skill. Here are the fires, one line each:

The symptomReach for
Checkout slows down whenever the analytics job runsPrimary-Replica: separate the workloads
The database is too big or too busy for any single machineSharding
Adding one cache node reshuffled almost every keyConsistent Hashing
One celebrity user, product, or tenant takes 40% of the loadThe hot-key escape hatches: split, salt, dedicate, cache
A crash lost writes that were already acknowledgedWrite-Ahead Log
"What was the state last Tuesday?" has no answerEvent Sourcing
One table serves five query shapes, all badlyCQRS: purpose-built read models
Users see stale data after a bulk import or manual fixCDC: app-level invalidation misses bypass writes
The search index silently disagrees with the databaseCDC + outbox: dual-writes tear
Cache entries expire together and the database spikesCache Stampede Prevention
A retry double-charged a customerIdempotency
One slow dependency froze every server threadTimeout + Circuit Breaker
The retries made the outage worseRetry with Exponential Backoff: jitter and budgets
One poison message blocked the whole queueDead Letter Queue
Dashboards green, but one feature is starvingBulkhead
The feature failed and users got a blank error pageGraceful Degradation: design the lesser answer in advance
A refund processed before its chargePartitioned Consumption: key by customer
The producer outruns the consumer and memory climbsBackpressure: bound, drop by policy, or slow the source
The answer was correct but arrived hours too lateStream Processing
Finance and the dashboard report different revenueLambda & Kappa: the same question has two authors
Billing counts drift after every crash or deployExactly-Once Semantics
Two datacenters both think they are primaryQuorum: majorities prevent split brain
Money must move across systems that share no databaseSaga
Nobody can tell which service in the chain is slowDistributed Tracing
A release broke everyone at onceCanary Deployment + Feature Flags
The model is great offline and bad in productionFeature Store: training/serving skew
GPUs run at 8% utilization and the bill is absurdModel Serving & Batching
The traffic spike outran the ten-minute GPU bootGPU Auto-Scaling: warm pools and calendars
Provider keys are scattered and one team burned $40KLLM Gateway
40% of LLM queries are rephrasings paying full priceSemantic Caching
The chatbot confidently serves last quarter's policyRAG Pipeline

3. The Pattern Index

The course's sixty-plus patterns, one line each: the problem it solves, and the price you pay. Cover a column to self-test.

Module 2: Moving Data

PatternSolvesCosts
Request-ResponseAsk and wait: the default for user-facing readsCaller's fate tied to callee's: needs Module 5
Message QueueWork nobody waits on; bursts absorbed as lagAt-least-once delivery: consumers must dedupe
Publish-SubscribeOne event, many independent consumersYour event schema becomes a public contract
Event-Driven ArchitectureServices react to facts instead of calling each otherGovernance: who consumes what, and debugging flows
WebhooksPush across company boundariesVerify, persist, ack, dedupe, reconcile: all five
Server-Sent EventsServer streams updates over plain HTTP, auto-reconnectOne-directional only
Bidirectional StreamingTrue two-way conversation on one connectionSticky, stateful connections: two-tier gateways

Module 3: Storing Data

PatternSolvesCosts
Primary-ReplicaReads scale with copies; workloads separateReplication lag: read-your-own-writes needs care
ShardingData too big for one machine, split by keyThe key must be in every query; hot keys; cross-shard joins
Consistent HashingNodes come and go, moving only 1/N of keysRing management, virtual nodes
Write-Ahead LogDurability: record intent before applyingThe log must trim; anything holding it back fills the disk
Event SourcingComplete history: state derived from eventsThe default answer is no; event schemas live forever
CQRSEach query shape gets its own read modelEventual consistency between models; rebuild machinery

Module 4: Serving Data Fast

PatternSolvesCosts
Cache-AsideThe default cache: app checks, loads, storesInvalidation and staleness budgets are your job
Read-ThroughThe cache loads misses itselfA library or infra dependency in the read path
Write-ThroughReads always warm: cache written with the storeEvery write pays double latency
Write-BehindAbsorb write bursts, flush laterA loss window: never for money
Cache Stampede PreventionExpiry storms: single flight, jitter, early refreshComplexity on the hottest path

Module 5: Surviving Failure

PatternSolvesCosts
TimeoutNo wait is unboundedAmbiguity: the work may have happened anyway
Retry with Exponential BackoffTransient failures, retried politelyNeeds jitter, budgets, and idempotency, or it becomes the outage
IdempotencySame request twice, effect onceKeys generated at the source, honored end to end
Circuit BreakerStop calling the dead; fail fast; probe to recoverThresholds to tune; false trips
BulkheadOne workload cannot starve the restCapacity fragmentation
Dead Letter QueuePoison messages quarantined, the queue flowsThe DLQ needs an owner; ordering caveat
Graceful DegradationPre-designed lesser answers, shed by tierProduct decisions made in advance; fail open vs. closed per feature

Module 6: Growing Under Load

PatternSolvesCosts
Vertical ScalingThe bigger box: simplest capacityA ceiling, and one failure domain
Horizontal ScalingMany stateless copiesState must move out; per-server counters lie
Load BalancingSpread work by health and actual loadWrong signals spread wrong; draining discipline
Auto-ScalingCapacity follows demand: calendar first, reactive secondReaction lag is physics; the max is a bulkhead
Connection PoolingReuse expensive connectionsPool math multiplies across the fleet

Module 7: Keeping Data Consistent

PatternSolvesCosts
Two-Phase CommitAtomic commit across participantsBlocks on coordinator failure; only within one trust boundary
SagaLong transactions as local steps plus compensationsDesigned undo; pivots ordered last
QuorumMajority agreement: W+R>N; no split brainLatency, and minority partitions go read-only
Vector ClocksDetect concurrent edits, preserve causalitySiblings someone must merge; deletions need tombstones

Module 8: The Entry Point

PatternSolvesCosts
Reverse ProxyOne entry point: TLS, routing, shieldingOne more hop, HA required
CDNContent cached at the edge, near usersInvalidation; private data never enters shared caches
API GatewayCross-cutting policy once: auth, limits, routingStays thin, or becomes the monolith in disguise
Backend for FrontendPer-client composition of readsDuplication; writes stay in the domains
Rate LimitingCapacity protected by tier: token bucket r/b429 UX; distributed counters
Cursor PaginationStable paging under live insertsNo jump-to-page-N
API VersioningChange without breaking clientsOld versions supported for years: changes that cannot be undone
SidecarCross-cutting code as a per-instance helper processResource overhead per instance
Service MeshSidecars everywhere plus a control plane: mTLS, retries, telemetryA heavy platform: clear the adoption bar first

Module 9: Operating in Production

PatternSolvesCosts
Health Check EndpointReadiness vs. liveness; deploys gated on truthShallow checks can be wrong
Distributed TracingThe request's story across servicesInstrumentation effort; sampling decisions
Blue-Green DeploymentInstant switch, instant rollbackThe database does not blue-green: expand-contract
Canary DeploymentSmall slice judged against a concurrent baselineNeeds real verdict metrics, or the verdict means nothing
Feature FlagsDeploy and release split; behavior flipped in secondsFlag debt: delete them

Module 10: Data-Intensive Systems

PatternSolvesCosts
MapReduceOne big question over a huge bounded datasetHours-stale by construction; the shuffle dominates
Stream ProcessingAnswers while the data is still arriving: keyed state, event time, watermarksThe steepest learning curve in the course; amended answers
Lambda & KappaBatch and streaming without two drifting codebasesOverwrite machinery, or retention and replay capacity
Change Data CaptureEvery committed change, published: cannot missTable schemas become contracts; slot retention watches the disk
Exactly-Once SemanticsCounted once despite crashes and replaysThroughput tax; the guarantee stops at external side effects
BackpressureThe producer outruns the consumer, by design not by outageSomeone upstream always feels it
Partitioned ConsumptionOrder per key, parallelism across keysPartition count is a ceiling; hot partitions

Module 11: AI-Era Systems

PatternSolvesCosts
Feature StoreOne feature definition, both training and servingA real platform to own
Model Serving & BatchingGPUs filled by continuous batching: 30x economicsA TTFT floor; shared fate in the batch; buy the engine
GPU Auto-ScalingMinute-long boots vs. minute-long spikes: warm pools, calendars, queue-depth signalsDeliberate idleness, priced as insurance
LLM GatewayOne egress door: keys, token budgets, routing, fallback sequenceCritical path; must stay thin: no prompts
Semantic CachingThe same question in different words, cached by meaningFalse hits cost trust: conservative thresholds, audits
Vector DB ShardingSimilarity indexes beyond one machine's RAMScatter-gather economics unless a tenant filter restores the key
RAG PipelineKnowledge with freshness, citations, and access controlRetrieval sets the quality ceiling; two pipelines to run

4. The Decision Cheat Sheet

The rulings the course's comparisons produced, one sentence each:

  1. Push vs. pull (the feed): push for the many, pull for the few: the celebrity threshold is empirical.
  2. SSE vs. WebSocket: if the client never needs to talk mid-stream, SSE: buy the two-way connection only when both directions are real.
  3. Queue vs. pub/sub: a queue when one consumer must do the work; pub/sub when many consumers each react to the fact.
  4. Cache strategy: cache-aside by default; read-through when the library fits; write-behind never for money.
  5. Vertical vs. horizontal: exhaust one machine before renting two hundred.
  6. 2PC vs. saga: 2PC only inside one trust boundary; sagas across boundaries; best of all, design the transaction away with ownership or a single journal.
  7. Batch vs. streaming: the staleness budget decides: don't stream what batch can serve within budget.
  8. Lambda vs. Kappa: one definition of truth per metric; Kappa where log retention covers the reprocessing horizon; accidental Lambda never.
  9. Idempotent vs. transactional sinks: keyed upserts first; transactions where outputs must move atomically with offsets: money, ledgers.
  10. Raw CDC vs. outbox: raw table streams for your own infrastructure; the outbox for events other teams consume; dual-writes never.
  11. RAG vs. fine-tuning vs. long context: RAG for knowledge, fine-tuning for behavior, long context for small stable corpora: and they compose.
  12. Own GPUs vs. provider APIs: API-first until volume, latency, or privacy forces the fleet: then the GPU lessons are the cost.

5. Seven Threads That Run Through Everything

Sixty-plus patterns, but far fewer underlying ideas. Reviewing these seven reviews half the course at once:

  1. Skew. Hashing spreads keys, never weight. The hot shard, the hot cache key, the slow reducer, the hot partition, the hot cluster, the giant tenant, the fee account: one problem, seven appearances, and the same remedies: split, salt, pre-aggregate, dedicate, cache.
  2. Same question, two authors. Dual-written search indexes, batch-vs-streaming metrics, training-vs-serving features: whenever the same logic lives in two codebases, it drifts. The cure is structural: one definition, compiled to every path.
  3. The log. The WAL under the database, replication feeding replicas, event sourcing's journal, Kafka's topics, CDC's published changes, streaming checkpoints, the agent's step log: append-only history plus a position is the course's single most reused idea. Durable state, recovery by replay.
  4. Budgets: staleness and guarantees, priced per question. How old may this answer be, and who audits this number? Dashboards tolerate; invoices don't. The same stream can serve both, with different machinery: pay for the guarantee only where the question demands it.
  5. Idempotency under at-least-once. Networks retry, frameworks retry, agents re-decide. Every delivery is at-least-once somewhere, so every effect needs a key that makes the second attempt harmless: generated at the source, honored at the sink.
  6. Ownership over agreement. The best distributed transaction is the one you designed away: one matcher owns a driver, one writer owns an account, one consumer owns a partition. Single ownership with short leases replaces locks and coordinators.
  7. Fail open vs. fail closed. Availability features degrade to lesser answers; money and authorization refuse instead. In AI systems the line runs between words and hands: words may degrade, hands must not.

6. The Whiteboard Checklist

The five questions, restated as the procedure to run on any blank whiteboard:

  1. Flow: who waits, and who shouldn't? (Sync request-response vs. async queues.)
  2. Storage: what is truth, and what is derived? (Sources vs. read models, caches, indexes.)
  3. Speed: what is read most, and how stale may it be? (Caching tiers, precomputation, budgets.)
  4. Failure: for every arrow: what happens when its far side hangs, dies, or answers twice? (Timeouts, retries, idempotency, breakers, degradation.)
  5. Growth: what doubles first, and what breaks when it does? (The bottleneck, the hot key, the scaling signal.)

And the three habits that frame it, from the first lesson onward:

  • Numbers before boxes: run the arithmetic first; let it veto over-engineering.
  • Every pattern pays its price aloud: name the cost in the same sentence as the pattern.
  • Question four wins interviews: the failure walk is where seniority shows.

If any row in this lesson surprised you, its link is the study list. Then close the course with the conclusion.

General
Test Your Knowledge
Check your understanding and reinforce the key concepts covered in this section with a short, targeted assessment.
10 Questions
~15 mins
Your progress is saved automatically

On This Page

  1. How to Use This Lesson
  1. Symptom → Pattern: The Diagnostic Table
  1. The Pattern Index
  1. The Decision Cheat Sheet
  1. Seven Threads That Run Through Everything
  1. The Whiteboard Checklist