Skip to content

Trade-offs

Every system design choice, with the numbers

What each option gives you, what it costs, what breaks if you are wrong, and when the answer changes. Free to read. No account needed.

Browse all trade-offsRead the full course

Level tags suggest where a guide is most useful. They do not set your AI mock level.

SDE-1 and SDE-2

Foundations

The choices every design round touches. Know when each side wins.

Add an index vs full table scan

When to add a database index and when a full table scan is the better plan, the numbers that decide, and what each choice costs on reads and writes.

SDE-1SDE-2

Batch vs real-time processing

When to process data in scheduled batches and when to process it as a stream in real time, the numbers that decide, and what breaks with each.

SDE-1SDE-2

CDN push vs pull

When a CDN should pull files from your server on demand and when you should push them ahead of time, the numbers that decide, and what breaks.

SDE-1SDE-2

JWT vs server sessions

When to use a signed token (JWT) and when to use a server-side session for login, the numbers that decide, and what breaks with each.

SDE-1SDE-2

L4 vs L7 load balancing

Which load balancer layer to use, L4 or L7, with the uneven-load numbers for long connections and the cost of reading requests.

SDE-1SDE-2Senior

LRU vs LFU

Which cache eviction rule to pick, LRU or LFU, with a worked hit-rate example, the cases where each fails, and the size check.

SDE-1SDE-2

Monolith vs microservices

When to keep one deployable program and when to split it into services, the numbers that decide, and what breaks with each choice.

SDE-1SDE-2

Normalize vs denormalize

When to keep each fact in one place and when to copy it on purpose, with the read-to-write numbers that decide it.

SDE-1SDE-2

Offset vs cursor pagination

When to page a long list with offset and when with a cursor, with row counts, the shifting-page problem and the index you need.

SDE-1SDE-2

Push vs pull

When to push data to the receiver and when to let the receiver pull it, the numbers that decide, and what breaks with each side.

SDE-1SDE-2

Queue vs pub/sub vs log

Which message system to choose: a queue, publish and subscribe, or a log. The numbers that change the answer and what breaks with each.

SDE-1SDE-2

Replication vs sharding

When to copy a database with replicas and when to split it with shards, the numbers that decide, and what each choice breaks and costs.

SDE-1SDE-2

REST vs gRPC vs GraphQL

Which API style to pick for browsers, partners and your own services, with call counts, message sizes and delay worked out.

SDE-1SDE-2Senior

Retry vs fail fast

When to retry a failed call and when to fail fast and return an error or a fallback, the numbers that decide, and what breaks with each.

SDE-1SDE-2

SQL vs NoSQL

When to choose a SQL database and when a NoSQL one, the numbers that change the answer, and what breaks with each.

SDE-1SDE-2

Synchronous vs asynchronous calls

When a caller should wait for the answer and when it should hand work off, the numbers that decide, and what breaks with each choice.

SDE-1SDE-2

Vertical vs horizontal scaling

When to buy a bigger machine and when to add more machines, with server counts, failure share and daily cost worked out.

SDE-1SDE-2Senior

SDE-2 and Senior

Production decisions

Where systems fail in real life: consistency, replication, messaging, storage engines.

B-tree vs LSM tree

Which storage engine to choose for a database, a B-tree or an LSM tree, with write amplification, read cost and disk wear worked out.

SDE-2Senior

Backpressure queue vs drop vs degrade

How to choose between queueing, dropping and degrading when work arrives faster than a service can finish it, with queue sizes worked out.

SDE-2Senior

Fan-out on write vs fan-out on read

How to choose between building each follower's feed when a post is made or when the feed is opened, the numbers that decide it, and what breaks.

SDE-2Senior

Hash vs range vs directory sharding

How to choose hash, range or directory sharding for your shard key, the numbers that change the answer, and what breaks when the data grows.

SDE-2Senior

Lease vs lock vs fencing token

How to choose between a plain lock, a lease with a time limit and a fencing token, with lease lengths, failure counts and the fallback.

SDE-2Senior

Local vs global secondary index

When to keep a secondary index inside each shard and when to build one global index, with query fan-out, write cost and lag worked out.

SDE-2Senior

Optimistic vs pessimistic locking

When to check a version at write time and when to lock a row first, with the clash rates and row limits that decide the choice.

SDE-2Senior

Precompute vs compute on read

When to store a ready answer in advance and when to calculate it at read time, the numbers that flip the choice, and what breaks with each.

SDE-2Senior

Saga vs two-phase commit

How to choose between a saga and two-phase commit for a job that spans several databases or services, the numbers that decide it, and what breaks.

SDE-2Senior

Senior and Staff

Senior and Staff

Decisions with no right side. How to decide, defend it with numbers, and change course later.

Batch size and buffering vs latency

How to choose batch size and wait time when you group messages or writes, with the throughput gain, the latency cost and the data at risk worked out.

SeniorStaff

Build vs buy vs managed service

How to choose between running a component yourself, buying a finished product and using a cloud managed service, with cost, people and exit numbers.

SeniorStaff

Consistency budget across services

How to decide how stale each service may be, by setting a delay budget for the whole user journey and sharing it among hops, with numbers and fallbacks.

SeniorStaff

N+1 vs N+2 capacity

How to choose how many spare servers to keep so a failure or a deploy causes no outage, with failure odds, cost and the zone-loss case.

SeniorStaff

Release speed vs release safety

How to balance shipping often against shipping safely: deploy on merge, staged canary rollout or a weekly release train, with error budget numbers.

SeniorStaff

Reserved vs on-demand vs spot capacity

How to mix committed, pay-as-you-go and spare-capacity servers to cut the cloud bill, with break-even use, regret cost and the safe order to start.

SeniorStaff

Rewrite vs strangler migration

When to rebuild an old system from scratch and when to replace it piece by piece behind a routing layer, with cost, risk and delay worked out.

SeniorStaff

Trace sampling vs full capture

How to choose between keeping every trace, sampling a fixed share at the start, or picking which to keep at the end, with storage cost and missed-bug math.

SeniorStaff

Know the trade-off. Now defend it.

Take an AI mock interview where the interviewer changes a number and asks if your choice still holds.