System Design Fundamentals
Core concepts every engineer should internalize when designing systems at scale.
CAP Theorem
You can only guarantee two of three properties in a distributed system:
- Consistency — Every read returns the most recent write
- Availability — Every request receives a response
- Partition Tolerance — System operates despite network failures
In practice, partitions are inevitable, so the real choice is between CP and AP.
Load Balancing Strategies
| Strategy | Use Case |
|---|---|
| Round Robin | Equal capacity servers |
| Least Connections | Varying request duration |
| Consistent Hashing | Distributed caches |
| Weighted | Mixed-capacity fleet |
Key Principles
- Design for failure — Everything fails, plan for it
- Keep it stateless — State belongs in dedicated stores
- Cache aggressively — But know your invalidation strategy
- Monitor everything — You can’t fix what you can’t see
Premature optimization is the root of all evil, but premature architecture is the root of all waste.
Read vs Write Heavy
Understanding your access patterns drives every design decision:
- Read-heavy: Add caching layers, read replicas, CDN
- Write-heavy: Write-behind caching, event sourcing, append-only logs
- Mixed: CQRS — separate read and write models