Sub topic 3
Make Trade-offs Explicit in a System Design
Assume you understand client-server architecture, HTTP APIs, databases, and short Python snippets. At this stage, the design should connect decisions to requirements instead of listing technologies.
Make trade-offs explicit
Every system design has competing goals. Lower latency may require caching, which can return stale data. Strong consistency can simplify correctness, but it can increase write latency and reduce availability during network failures.
| Decision | Benefit | Cost |
|---|---|---|
| Read replicas | More read capacity | Replication lag |
| Cache | Lower latency and database load | Stale or invalid data |
| Partitioning | More storage and write capacity | More complex queries |
State the trade-off and the reason for choosing it. For example: “We accept up to five seconds of staleness for the activity feed because fast reads matter more than immediate visibility.”
Deep dive into the riskiest component
Do not give every component equal detail. Choose the part most likely to fail or limit growth. It might be a hot partition, a cache invalidation path, or a queue that absorbs traffic spikes.
Describe its request flow, capacity limit, data ownership, and recovery behavior. Identify the bottleneck before proposing an optimization.
Plan for failure
List failures that affect user-visible behavior:
- A database replica is unavailable.
- A queue grows faster than workers can process it.
- A dependency times out.
- A network retry repeats a write.
Use timeouts, bounded retries, idempotency keys, health checks, and backups where appropriate. Decide whether the system should reject requests, serve stale data, or process work later.
Communicate and iterate
Present the design from requirements to capacity estimates, API, data model, architecture, and risky components. Explain one decision at a time. Ask which assumption should change, then revise the affected calculations and components rather than redrawing everything without reason.
Check the design against the requirements
Review each requirement explicitly:
- Does the API support every required operation?
- Does the capacity plan handle average and peak traffic?
- Do latency and consistency match the stated targets?
- Does the failure plan protect important data?
- Can the design grow without a dangerous single bottleneck?
Exercise
A feed allows five seconds of staleness but must remain available during a replica failure. Which choice fits better: strong reads from one primary, or cached reads with a replica fallback? State one cost.
Show answer
Cached reads with a replica fallback fit better because they preserve availability and latency. The cost is that users may see stale feed entries.