Design a URL shortener
Classic system-design exercise: take a long URL, return a short one; redirect the short one to the long one at scale. Walk through the trade-offs.
Scalability — vertical vs horizontal, stateless services
🏗️ System Design Essentials · Scaling a system means serving more load without falling over. The choice — bigger machines or more machines — defines the rest of the architecture.
Load Balancing — L4 vs L7, algorithms, health checks
🏗️ System Design Essentials · The traffic cop in front of your service pool. Decides which backend handles each request, detects dead ones, and keeps things flowing.
Caching — layers, strategies, invalidation
🏗️ System Design Essentials · Speed up reads by storing recent/popular results closer to the caller. Done right, it turns a 100ms DB query into a 1ms cache hit.
SQL vs NoSQL — when each shines
🏗️ System Design Essentials · Relational (ACID, joins, strong schema) vs document/key-value/wide-column/graph (schema flexibility, horizontal scale by default). Pick by use case, not hype.
Replication & Sharding
🏗️ System Design Essentials · Replication = multiple copies of the same data for availability/read scaling. Sharding = splitting data across nodes for write scaling. Both are essential at scale.
API Design — REST, RPC, GraphQL
🏗️ System Design Essentials · Resource-oriented REST is the default. RPC (gRPC) for internal high-throughput. GraphQL for flexible client-driven queries. Pick by fit, not fashion.
Observability — logs, metrics, traces, SLOs
🏗️ System Design Essentials · The three pillars (logs, metrics, traces) tell you WHAT broke. SLIs/SLOs tell you if it MATTERS. You need both.