Skip to content
Tutorials Center
My learning

Topics

Lesson 64 of 65 ยท Practice and Interviews

System Design Trade-offs Cheat Sheet

A practical cheat sheet of system design trade-offs: SQL vs NoSQL, push vs pull, cache strategies, consistency levels, sync vs async, monolith vs microservices, with a Python decision helper.

Good system design is mostly choosing between options that each have a cost. This cheat sheet lists the choices that appear again and again, with a one-line rule for when to pick each side. Use it to check yourself during practice, and to phrase your reasoning in an interview: "I choose A because of X, and I accept the cost Y."

Treat the rules as defaults, not laws. When the requirements point the other way, follow the requirements.

Data and storage

Choice Pick the first when... Pick the second when...
SQL vs NoSQL You need joins, transactions, a flexible query, strong consistency You need massive horizontal scale, simple access by key, flexible schema
Normalize vs denormalize Writes are frequent and consistency matters Reads dominate and joins are too slow
Single DB vs sharded Data and traffic fit one primary plus replicas One machine cannot hold the data or write load
Replicas vs sharding You need more read capacity or availability You need more write capacity or storage
Object store vs database Large blobs (images, video, backups) Small structured records with queries
Row store vs column store Many small transactional reads and writes Analytics scanning a few columns of huge tables
Search index vs DB query Full-text, ranking, faceting Exact key or simple filter lookups

Consistency and availability

Choice Pick the first when... Pick the second when...
Strong vs eventual consistency Money, inventory, uniqueness, anything where staleness is harmful Feeds, counters, likes, caches, where seeing old data briefly is fine
CP vs AP in a partition Correctness over uptime (payments, locks) Uptime over perfect agreement (shopping carts, social posts)
Synchronous vs asynchronous replication You cannot lose acknowledged writes Low write latency matters more, a small loss window is acceptable
Quorum settings R+W > N for read-your-writes R=1 or W=1 for speed

Caching

Choice Meaning
Cache-aside App reads cache, loads DB on miss. Simple, popular, risk of stale data.
Read-through The cache loads data itself. Cleaner app code.
Write-through Write cache and DB together. Consistent, slower writes.
Write-back Write cache, flush later. Fast, risk of loss on crash.
TTL vs explicit invalidation TTL is simple and eventually fresh; invalidation is precise but easy to get wrong.
Local vs distributed cache Local is fastest but each node differs; distributed is shared and consistent but one network hop away.

Communication and flow

Choice Pick the first when... Pick the second when...
Sync vs async The user needs the result now Work can finish later (emails, video encoding)
Push vs pull Low-latency delivery to many readers, small fan-out Huge fan-out or consumer controls pace
Fan-out on write vs read Reads dominate, normal fan-out Celebrity or huge fan-out, rarely read data
Polling vs WebSockets Infrequent updates, simple Real-time, bidirectional
REST vs gRPC vs GraphQL REST for public, simple APIs; gRPC for internal low-latency; GraphQL for flexible client queries
Queue vs stream Queue: each task handled once by one worker; stream/log: many consumers, replay

Architecture

Choice Pick the first when... Pick the second when...
Monolith vs microservices Small team, early product, shared data Many teams, independent scaling and deployment, clear boundaries
Vertical vs horizontal scaling Quick fix, simple stateful systems Long-term growth, fault tolerance
Stateless vs stateful services Anything you want to scale or restart easily State must live somewhere; push it into data stores
Build vs buy Core differentiator Commodity (auth, payments, email)
Single vs multi-region One user base, simpler operations Global latency or disaster tolerance requirements
Retry vs fail fast Transient errors, idempotent operations Overloaded dependency; retries make it worse
Python A tiny decision helper

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

A rule-based helper is naive, but writing your reasoning as explicit rules is good practice: if you cannot list the reasons, you do not yet have a design.

Consistency choices in numbers

Quorum math makes the latency versus consistency trade-off concrete.

Python Quorum settings compared

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

R=1, W=3 gives fresh reads and fast reads, but no write survives a single failed node. There is no free option; the table shows exactly what each setting buys.

How to talk about a trade-off

Use a three-part sentence: choice, reason, cost.

  • "I'll use a queue between checkout and email, because email can be slow and must not block the order. The cost is that emails arrive a few seconds late and I need idempotent consumers."
  • "I'll shard by user ID, because almost every query is per user. The cost is that cross-user queries become scatter-gather, so analytics goes to a separate warehouse."
  • "I'll accept eventual consistency for like counts, because exact counts are not worth the coordination. The cost is that two users may briefly see different numbers."

Questions that expose trade-offs

  1. What breaks first if traffic grows ten times?
  2. What happens when this component is unavailable for five minutes?
  3. Can a user see stale data here, and is that acceptable?
  4. Which part is the hardest to change later (data model, API, partition key)?
  5. Where does the complexity come from, and is it worth it?

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. You need more write capacity than one primary can handle. What helps?

    Replicas scale reads; sharding splits the write load across machines.
  2. 2. Which data fits eventual consistency best?

    A briefly stale like count harms nobody; the others need strict correctness.
  3. 3. Write-back caching risks what?

    Writes are acknowledged from the cache before reaching the database.
  4. 4. A good trade-off statement includes:

    Naming the cost shows you understand the option, not just its marketing.

Summary

  • Every design decision has a cost; name it.
  • Replicas scale reads, sharding scales writes; strong consistency for money, eventual for feeds and counters.
  • Choose a cache write policy based on how much loss and staleness you can accept.
  • Prefer async work for anything the user does not wait for; prefer simple monoliths until team and scale demand otherwise.
  • Phrase decisions as choice, reason, cost.

Next: System Design Practice Questions