0% completed
Pattern Review
On This Page
- How to Use This Lesson
- Symptom → Pattern: The Diagnostic Table
- The Pattern Index
- The Decision Cheat Sheet
- Seven Threads That Run Through Everything
- 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:
- The night before an interview: read sections 2 through 5 top to bottom (about 15 minutes), then run one capstone actively.
- During design work: use section 2 as a lookup: find your symptom, follow the link.
- 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 symptom | Reach for |
|---|---|
| Checkout slows down whenever the analytics job runs | Primary-Replica: separate the workloads |
| The database is too big or too busy for any single machine | Sharding |
| Adding one cache node reshuffled almost every key | Consistent Hashing |
| One celebrity user, product, or tenant takes 40% of the load | The hot-key escape hatches: split, salt, dedicate, cache |
| A crash lost writes that were already acknowledged | Write-Ahead Log |
| "What was the state last Tuesday?" has no answer | Event Sourcing |
| One table serves five query shapes, all badly | CQRS: purpose-built read models |
| Users see stale data after a bulk import or manual fix | CDC: app-level invalidation misses bypass writes |
| The search index silently disagrees with the database | CDC + outbox: dual-writes tear |
| Cache entries expire together and the database spikes | Cache Stampede Prevention |
| A retry double-charged a customer | Idempotency |
| One slow dependency froze every server thread | Timeout + Circuit Breaker |
| The retries made the outage worse | Retry with Exponential Backoff: jitter and budgets |
| One poison message blocked the whole queue | Dead Letter Queue |
| Dashboards green, but one feature is starving | Bulkhead |
| The feature failed and users got a blank error page | Graceful Degradation: design the lesser answer in advance |
| A refund processed before its charge | Partitioned Consumption: key by customer |
| The producer outruns the consumer and memory climbs | Backpressure: bound, drop by policy, or slow the source |
| The answer was correct but arrived hours too late | Stream Processing |
| Finance and the dashboard report different revenue | Lambda & Kappa: the same question has two authors |
| Billing counts drift after every crash or deploy | Exactly-Once Semantics |
| Two datacenters both think they are primary | Quorum: majorities prevent split brain |
| Money must move across systems that share no database | Saga |
| Nobody can tell which service in the chain is slow | Distributed Tracing |
| A release broke everyone at once | Canary Deployment + Feature Flags |
| The model is great offline and bad in production | Feature Store: training/serving skew |
| GPUs run at 8% utilization and the bill is absurd | Model Serving & Batching |
| The traffic spike outran the ten-minute GPU boot | GPU Auto-Scaling: warm pools and calendars |
| Provider keys are scattered and one team burned $40K | LLM Gateway |
| 40% of LLM queries are rephrasings paying full price | Semantic Caching |
| The chatbot confidently serves last quarter's policy | RAG 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
| Pattern | Solves | Costs |
|---|---|---|
| Request-Response | Ask and wait: the default for user-facing reads | Caller's fate tied to callee's: needs Module 5 |
| Message Queue | Work nobody waits on; bursts absorbed as lag | At-least-once delivery: consumers must dedupe |
| Publish-Subscribe | One event, many independent consumers | Your event schema becomes a public contract |
| Event-Driven Architecture | Services react to facts instead of calling each other | Governance: who consumes what, and debugging flows |
| Webhooks | Push across company boundaries | Verify, persist, ack, dedupe, reconcile: all five |
| Server-Sent Events | Server streams updates over plain HTTP, auto-reconnect | One-directional only |
| Bidirectional Streaming | True two-way conversation on one connection | Sticky, stateful connections: two-tier gateways |
Module 3: Storing Data
| Pattern | Solves | Costs |
|---|---|---|
| Primary-Replica | Reads scale with copies; workloads separate | Replication lag: read-your-own-writes needs care |
| Sharding | Data too big for one machine, split by key | The key must be in every query; hot keys; cross-shard joins |
| Consistent Hashing | Nodes come and go, moving only 1/N of keys | Ring management, virtual nodes |
| Write-Ahead Log | Durability: record intent before applying | The log must trim; anything holding it back fills the disk |
| Event Sourcing | Complete history: state derived from events | The default answer is no; event schemas live forever |
| CQRS | Each query shape gets its own read model | Eventual consistency between models; rebuild machinery |
Module 4: Serving Data Fast
| Pattern | Solves | Costs |
|---|---|---|
| Cache-Aside | The default cache: app checks, loads, stores | Invalidation and staleness budgets are your job |
| Read-Through | The cache loads misses itself | A library or infra dependency in the read path |
| Write-Through | Reads always warm: cache written with the store | Every write pays double latency |
| Write-Behind | Absorb write bursts, flush later | A loss window: never for money |
| Cache Stampede Prevention | Expiry storms: single flight, jitter, early refresh | Complexity on the hottest path |
Module 5: Surviving Failure
| Pattern | Solves | Costs |
|---|---|---|
| Timeout | No wait is unbounded | Ambiguity: the work may have happened anyway |
| Retry with Exponential Backoff | Transient failures, retried politely | Needs jitter, budgets, and idempotency, or it becomes the outage |
| Idempotency | Same request twice, effect once | Keys generated at the source, honored end to end |
| Circuit Breaker | Stop calling the dead; fail fast; probe to recover | Thresholds to tune; false trips |
| Bulkhead | One workload cannot starve the rest | Capacity fragmentation |
| Dead Letter Queue | Poison messages quarantined, the queue flows | The DLQ needs an owner; ordering caveat |
| Graceful Degradation | Pre-designed lesser answers, shed by tier | Product decisions made in advance; fail open vs. closed per feature |
Module 6: Growing Under Load
| Pattern | Solves | Costs |
|---|---|---|
| Vertical Scaling | The bigger box: simplest capacity | A ceiling, and one failure domain |
| Horizontal Scaling | Many stateless copies | State must move out; per-server counters lie |
| Load Balancing | Spread work by health and actual load | Wrong signals spread wrong; draining discipline |
| Auto-Scaling | Capacity follows demand: calendar first, reactive second | Reaction lag is physics; the max is a bulkhead |
| Connection Pooling | Reuse expensive connections | Pool math multiplies across the fleet |
Module 7: Keeping Data Consistent
| Pattern | Solves | Costs |
|---|---|---|
| Two-Phase Commit | Atomic commit across participants | Blocks on coordinator failure; only within one trust boundary |
| Saga | Long transactions as local steps plus compensations | Designed undo; pivots ordered last |
| Quorum | Majority agreement: W+R>N; no split brain | Latency, and minority partitions go read-only |
| Vector Clocks | Detect concurrent edits, preserve causality | Siblings someone must merge; deletions need tombstones |
Module 8: The Entry Point
| Pattern | Solves | Costs |
|---|---|---|
| Reverse Proxy | One entry point: TLS, routing, shielding | One more hop, HA required |
| CDN | Content cached at the edge, near users | Invalidation; private data never enters shared caches |
| API Gateway | Cross-cutting policy once: auth, limits, routing | Stays thin, or becomes the monolith in disguise |
| Backend for Frontend | Per-client composition of reads | Duplication; writes stay in the domains |
| Rate Limiting | Capacity protected by tier: token bucket r/b | 429 UX; distributed counters |
| Cursor Pagination | Stable paging under live inserts | No jump-to-page-N |
| API Versioning | Change without breaking clients | Old versions supported for years: changes that cannot be undone |
| Sidecar | Cross-cutting code as a per-instance helper process | Resource overhead per instance |
| Service Mesh | Sidecars everywhere plus a control plane: mTLS, retries, telemetry | A heavy platform: clear the adoption bar first |
Module 9: Operating in Production
| Pattern | Solves | Costs |
|---|---|---|
| Health Check Endpoint | Readiness vs. liveness; deploys gated on truth | Shallow checks can be wrong |
| Distributed Tracing | The request's story across services | Instrumentation effort; sampling decisions |
| Blue-Green Deployment | Instant switch, instant rollback | The database does not blue-green: expand-contract |
| Canary Deployment | Small slice judged against a concurrent baseline | Needs real verdict metrics, or the verdict means nothing |
| Feature Flags | Deploy and release split; behavior flipped in seconds | Flag debt: delete them |
Module 10: Data-Intensive Systems
| Pattern | Solves | Costs |
|---|---|---|
| MapReduce | One big question over a huge bounded dataset | Hours-stale by construction; the shuffle dominates |
| Stream Processing | Answers while the data is still arriving: keyed state, event time, watermarks | The steepest learning curve in the course; amended answers |
| Lambda & Kappa | Batch and streaming without two drifting codebases | Overwrite machinery, or retention and replay capacity |
| Change Data Capture | Every committed change, published: cannot miss | Table schemas become contracts; slot retention watches the disk |
| Exactly-Once Semantics | Counted once despite crashes and replays | Throughput tax; the guarantee stops at external side effects |
| Backpressure | The producer outruns the consumer, by design not by outage | Someone upstream always feels it |
| Partitioned Consumption | Order per key, parallelism across keys | Partition count is a ceiling; hot partitions |
Module 11: AI-Era Systems
| Pattern | Solves | Costs |
|---|---|---|
| Feature Store | One feature definition, both training and serving | A real platform to own |
| Model Serving & Batching | GPUs filled by continuous batching: 30x economics | A TTFT floor; shared fate in the batch; buy the engine |
| GPU Auto-Scaling | Minute-long boots vs. minute-long spikes: warm pools, calendars, queue-depth signals | Deliberate idleness, priced as insurance |
| LLM Gateway | One egress door: keys, token budgets, routing, fallback sequence | Critical path; must stay thin: no prompts |
| Semantic Caching | The same question in different words, cached by meaning | False hits cost trust: conservative thresholds, audits |
| Vector DB Sharding | Similarity indexes beyond one machine's RAM | Scatter-gather economics unless a tenant filter restores the key |
| RAG Pipeline | Knowledge with freshness, citations, and access control | Retrieval sets the quality ceiling; two pipelines to run |
4. The Decision Cheat Sheet
The rulings the course's comparisons produced, one sentence each:
- Push vs. pull (the feed): push for the many, pull for the few: the celebrity threshold is empirical.
- SSE vs. WebSocket: if the client never needs to talk mid-stream, SSE: buy the two-way connection only when both directions are real.
- Queue vs. pub/sub: a queue when one consumer must do the work; pub/sub when many consumers each react to the fact.
- Cache strategy: cache-aside by default; read-through when the library fits; write-behind never for money.
- Vertical vs. horizontal: exhaust one machine before renting two hundred.
- 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.
- Batch vs. streaming: the staleness budget decides: don't stream what batch can serve within budget.
- Lambda vs. Kappa: one definition of truth per metric; Kappa where log retention covers the reprocessing horizon; accidental Lambda never.
- Idempotent vs. transactional sinks: keyed upserts first; transactions where outputs must move atomically with offsets: money, ledgers.
- Raw CDC vs. outbox: raw table streams for your own infrastructure; the outbox for events other teams consume; dual-writes never.
- RAG vs. fine-tuning vs. long context: RAG for knowledge, fine-tuning for behavior, long context for small stable corpora: and they compose.
- 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:
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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:
- Flow: who waits, and who shouldn't? (Sync request-response vs. async queues.)
- Storage: what is truth, and what is derived? (Sources vs. read models, caches, indexes.)
- Speed: what is read most, and how stale may it be? (Caching tiers, precomputation, budgets.)
- Failure: for every arrow: what happens when its far side hangs, dies, or answers twice? (Timeouts, retries, idempotency, breakers, degradation.)
- 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.
On This Page
- How to Use This Lesson
- Symptom → Pattern: The Diagnostic Table
- The Pattern Index
- The Decision Cheat Sheet
- Seven Threads That Run Through Everything
- The Whiteboard Checklist