Topic 0.4
Trade-offs
In one line
The most senior signal in an interview is the ability to answer 'why this and not that?' Every architectural decision is a trade-off; interviews test whether you can name the thing you gave up.
Think of it like this
Choosing between a bike and a car to get to work. The bike is cheap and beats traffic but gets you wet in the rain; the car is comfortable but costs more and gets stuck in jams. No option is 'best'; it depends on what you need today.
Key ideas
- 01
SQL vs NoSQL: SQL = joins, transactions, strong consistency; NoSQL = horizontal write scaling, flexible schema, eventual consistency.
- 02
Why Redis: in-memory reads at ~0.1ms vs ~1–5ms for a DB hit; the price is memory cost and cache invalidation.
- 03
Why Kafka: durable, replayable, high-throughput event log; the price is ordering complexity and exactly-once difficulty.
- 04
Why asynchronous: decouples producers/consumers, absorbs bursts, enables retries; the price is eventual consistency and harder debugging.
- 05
Why eventual consistency: low latency and high availability during partitions; the price is stale reads.
- 06
Why microservices: independent scaling, team autonomy, isolated blast radius; the price is distributed-systems complexity.
- 07
Why monolith: simplest possible start, low latency, no network failures; the price is coupling and scaling at the unit of the whole app.
- 08
Every 'why' must end with a measured cost, not a slogan.
Java / Spring map
- →
Spring Boot gives you the monolith trivially; adding Kafka + Redis + multiple services is a conscious complexity purchase.
Explain without notes
Defend why you would still choose a monolith for a 20-person startup.
Name two real costs of choosing microservices (not abstractions — concrete incidents).
Practice
For each 'Why X?' question in this topic, write a one-paragraph answer with a concrete number or failure mode.
Trade-offs
- ↔
The classic interview trap: 'which database would you use?' — the correct answer is 'it depends on the access pattern and consistency budget'.
Run it in production
You've designed it. Now build, operate, and break the same idea hands-on in the DevOps courses:
Completion checklist
I can answer all seven 'Why X?' questions with a real trade-off each.