System Design Fundamentals Every Developer Should Know
System design interviews at companies like Google, Amazon, and Flipkart can feel intimidating. But here's the thing—they're testing a skill you'll actually use daily as a senior engineer. Let me break down the concepts that matter.
The Building Blocks
Every large system uses these components in some combination:
Load Balancers
Distribute traffic across multiple servers. Think of it like having multiple billing counters at Big Bazaar during a sale.
User Requests → Load Balancer → Server 1
→ Server 2
→ Server 3
Common algorithms:
- Round Robin: Requests go to each server in turn
- Least Connections: Send to server with fewest active connections
- IP Hash: Same user always hits same server (useful for sessions)
Caching
The single biggest performance improvement you can make. A cache hit is ~100x faster than a database query.
User → Cache (Redis) → Cache Hit? Return data
→ Cache Miss? Query DB → Store in Cache → Return
Cache invalidation strategies:
- TTL (Time to Live): Data expires after set time
- Write-through: Update cache when DB updates
- Write-behind: Update cache first, DB asynchronously
Databases
SQL (PostgreSQL, MySQL)
- ACID compliant
- Complex queries with JOINs
- Best for: Banking, inventory, anything needing transactions
NoSQL (MongoDB, Cassandra)
- Flexible schema
- Horizontal scaling
- Best for: Logs, analytics, rapidly changing data
Message Queues
When you can't process requests immediately:
User Order → Queue (RabbitMQ/Kafka) → Order Processing Service
→ Email Service
→ Analytics Service
Designing for Scale
Horizontal vs Vertical Scaling
Vertical: Bigger server (limited by hardware) Horizontal: More servers (preferred for web apps)
Database Sharding
Split data across multiple databases:
- By user ID: Users 1-1M on DB1, 1M-2M on DB2
- By geography: India users on Mumbai cluster, US on Virginia
CDN (Content Delivery Network)
Serve static assets from servers closest to users. Cloudflare, AWS CloudFront, or Akamai.
Real-World Example: URL Shortener
Let's design something like bit.ly:
Requirements:
- Shorten long URLs
- Redirect shortened URLs
- Handle 100M URLs, 1000 redirects/second
High-Level Design:
User → API Gateway → URL Service → Database
→ Cache (hot URLs)
URL Generation:
1. Take MD5 hash of original URL
2. Encode first 7 chars in base62
3. Check for collisions
4. Store mapping in DB
Storage Calculations:
- 100M URLs × 500 bytes = 50GB (fits in single DB with indexing)
- 1000 redirects/second = cache the top 20% (Pareto principle)
Interview Framework
When given any system design question:
-
Clarify requirements (5 mins)
- Who are the users?
- What scale are we talking?
- What features are must-have vs nice-to-have?
-
High-level design (10 mins)
- Draw main components
- Show data flow
-
Deep dive (15 mins)
- Database schema
- API design
- Scaling considerations
-
Trade-offs and alternatives (5 mins)
- What could fail?
- How would you monitor?
Resources for Further Learning
- "Designing Data-Intensive Applications" by Martin Kleppmann
- System Design Primer on GitHub
- Real company engineering blogs (Uber, Netflix, Spotify)
The goal isn't to memorize solutions—it's to develop intuition for how systems work together. Build small projects that use these patterns, and the interview becomes a conversation about things you've actually done.