Top 20 System Design Interview Questions
Master the most common system design interview questions asked at FAANG companies with detailed solutions, trade-offs, and best practices.
Top 20 System Design Interview Questions
How to Approach System Design Interviews
The Framework (RADIO)
-
Requirements (5 min)
- Functional requirements
- Non-functional requirements
- Scale estimates
-
API Design (5 min)
- Core APIs
- Request/Response formats
-
Database Design (10 min)
- Schema design
- Database choice
- Sharding strategy
-
Implementation (20 min)
- High-level architecture
- Component design
- Data flow
-
Optimization (10 min)
- Bottlenecks
- Trade-offs
- Scaling strategies
Top 20 Questions
1. Design URL Shortener (TinyURL)
Difficulty: Easy
Companies: Google, Amazon, Microsoft
Key Points:
- Base62 encoding for short URLs
- Hash collision handling
- Database: NoSQL (Cassandra) for high writes
- Caching: Redis for popular URLs
- Scale: 100M URLs/day, 10:1 read/write ratio
Architecture:
Client → Load Balancer → API Servers → Cache → Database
↓
Analytics Service
2. Design Instagram
Difficulty: Medium
Companies: Facebook, Instagram, Snapchat
Key Points:
- Image storage: S3 + CDN
- Feed generation: Fan-out on write vs read
- Database: Cassandra for posts, Redis for feeds
- Real-time updates: WebSockets
- Scale: 500M users, 95M photos/day
Components:
- Upload Service
- Feed Service
- Notification Service
- Search Service
- Recommendation Engine
3. Design Twitter
Difficulty: Medium
Companies: Twitter, Facebook, LinkedIn
Key Points:
- Tweet storage: Cassandra (time-series data)
- Timeline: Pre-computed (fan-out on write)
- Celebrity problem: Hybrid approach
- Real-time: WebSockets for notifications
- Scale: 400M tweets/day, 200M users
Trade-offs:
- Fan-out on write: Fast reads, slow writes
- Fan-out on read: Fast writes, slow reads
- Hybrid: Best of both for celebrities
4. Design Netflix
Difficulty: Hard
Companies: Netflix, YouTube, Amazon Prime
Key Points:
- CDN for video delivery (95% traffic)
- Adaptive bitrate streaming (HLS)
- Recommendation: ML models + A/B testing
- Encoding: Distributed transcoding
- Scale: 200M users, 100M concurrent streams
Architecture:
Client → CDN (CloudFront) → Origin (S3)
↓
API Gateway → Microservices → Databases
5. Design Uber
Difficulty: Hard
Companies: Uber, Lyft, DoorDash
Key Points:
- Geospatial indexing: QuadTree/Geohash
- Real-time matching: WebSockets
- ETA calculation: Graph algorithms
- Surge pricing: Dynamic pricing algorithm
- Scale: 100M rides/day, 10M drivers
Components:
- Location Service
- Matching Service
- Pricing Service
- Payment Service
- Notification Service
6. Design WhatsApp
Difficulty: Medium
Companies: WhatsApp, Telegram, Signal
Key Points:
- Message queue: Kafka for reliability
- End-to-end encryption
- Online/offline status: Redis
- Media storage: S3
- Scale: 2B users, 100B messages/day
Architecture:
Client ↔ WebSocket Server ↔ Message Queue ↔ Database
↓
Notification Service
7. Design YouTube
Difficulty: Hard
Companies: YouTube, Vimeo, TikTok
Key Points:
- Video processing: Distributed encoding
- CDN: Multi-tier caching
- Recommendation: Collaborative filtering
- Comments: Cassandra (time-series)
- Scale: 500 hours uploaded/min, 1B users
Challenges:
- Copyright detection
- Content moderation
- Live streaming
- Monetization
8. Design Facebook Newsfeed
Difficulty: Medium
Companies: Facebook, LinkedIn, Reddit
Key Points:
- Ranking algorithm: EdgeRank
- Feed generation: Hybrid fan-out
- Real-time updates: Long polling
- Ads insertion: ML-based
- Scale: 2B users, 300M posts/day
Ranking Factors:
- Affinity score
- Post weight
- Time decay
- Engagement signals
9. Design Dropbox
Difficulty: Medium
Companies: Dropbox, Google Drive, OneDrive
Key Points:
- Chunking: Split files into 4MB chunks
- Deduplication: Hash-based
- Sync: Delta sync for efficiency
- Conflict resolution: Last-write-wins
- Scale: 500M users, 1B files
Components:
- Upload Service
- Sync Service
- Metadata Service
- Notification Service
10. Design Rate Limiter
Difficulty: Easy
Companies: All FAANG
Key Points:
- Algorithms: Token bucket, Leaky bucket
- Storage: Redis with TTL
- Distributed: Consistent hashing
- Rules: Per user, per IP, per API
- Scale: 10K requests/sec
Implementation:
def is_allowed(user_id, limit, window):
key = f"rate_limit:{user_id}"
count = redis.incr(key)
if count == 1:
redis.expire(key, window)
return count <= limit
11. Design Web Crawler
Difficulty: Medium
Companies: Google, Bing, DuckDuckGo
Key Points:
- URL frontier: Priority queue
- Politeness: Rate limiting per domain
- Deduplication: Bloom filter
- Distributed: Consistent hashing
- Scale: 1B pages/day
Components:
- URL Frontier
- Fetcher
- Parser
- Deduplicator
- Storage
12. Design Notification System
Difficulty: Medium
Companies: All companies
Key Points:
- Channels: Email, SMS, Push, In-app
- Priority queue: Urgent vs normal
- Rate limiting: Per user preferences
- Retry mechanism: Exponential backoff
- Scale: 100M notifications/day
Architecture:
Event → Queue → Notification Service → Channels
↓
Template Service
13. Design Search Autocomplete
Difficulty: Medium
Companies: Google, Amazon, Bing
Key Points:
- Trie data structure
- Caching: Redis for popular queries
- Ranking: Frequency + recency
- Personalization: User history
- Scale: 10K queries/sec
Optimization:
- Prefix caching
- Async updates
- Distributed tries
14. Design Ticketmaster
Difficulty: Hard
Companies: Ticketmaster, StubHub, Eventbrite
Key Points:
- Inventory management: Pessimistic locking
- Queue system: Virtual waiting room
- Payment: Two-phase commit
- Scalability: Handle traffic spikes
- Scale: 1M tickets/event, 100K concurrent users
Challenges:
- Prevent overselling
- Handle bots
- Fair distribution
- High availability
15. Design Parking Lot
Difficulty: Easy
Companies: Amazon, Microsoft, Apple
Key Points:
- OOP design: Classes and interfaces
- Spot allocation: First available
- Payment: Multiple methods
- Real-time availability
- Scale: 1000 spots, 10K vehicles/day
Classes:
- ParkingLot
- Floor
- ParkingSpot
- Vehicle
- Ticket
16. Design API Gateway
Difficulty: Medium
Companies: All companies
Key Points:
- Routing: Path-based, header-based
- Authentication: JWT, OAuth
- Rate limiting: Token bucket
- Load balancing: Round-robin, least connections
- Scale: 100K requests/sec
Features:
- Request/response transformation
- Caching
- Logging
- Monitoring
17. Design Distributed Cache
Difficulty: Medium
Companies: All FAANG
Key Points:
- Consistent hashing: Minimize rehashing
- Eviction: LRU, LFU, TTL
- Replication: Master-slave
- Sharding: Hash-based
- Scale: 1M keys, 10K ops/sec
Implementation:
Client → Cache Cluster (Consistent Hashing)
↓
[Node1, Node2, Node3, ...]
18. Design Message Queue
Difficulty: Hard
Companies: Amazon (SQS), Google (Pub/Sub)
Key Points:
- Persistence: Disk-based
- Ordering: FIFO queues
- Delivery: At-least-once, exactly-once
- Scalability: Partitioning
- Scale: 1M messages/sec
Components:
- Producer
- Broker
- Consumer
- Dead letter queue
19. Design Yelp
Difficulty: Medium
Companies: Yelp, Foursquare, Google Maps
Key Points:
- Geospatial search: QuadTree
- Reviews: Cassandra (time-series)
- Ranking: Rating + distance + popularity
- Real-time updates: WebSockets
- Scale: 100M businesses, 1B searches/day
Search Algorithm:
1. Find nearby businesses (QuadTree)
2. Filter by category, rating
3. Rank by relevance
4. Paginate results
20. Design Payment System
Difficulty: Hard
Companies: PayPal, Stripe, Square
Key Points:
- Double-entry bookkeeping
- Idempotency: Prevent duplicate charges
- Reconciliation: Daily settlement
- Fraud detection: ML models
- Scale: 1M transactions/day
Architecture:
Client → API Gateway → Payment Service → Bank API
↓
Ledger Service
↓
Reconciliation Service
Common Patterns
1. Caching Strategy
Cache-Aside:
1. Check cache
2. If miss, query database
3. Update cache
4. Return result
Write-Through:
1. Write to cache
2. Write to database
3. Return success
Write-Behind:
1. Write to cache
2. Async write to database
3. Return success immediately
2. Database Sharding
Hash-Based:
shard = hash(user_id) % num_shards
Range-Based:
shard = user_id / shard_size
Geographic:
shard = user_location
3. Load Balancing
Round Robin: Distribute evenly
Least Connections: Send to least busy
IP Hash: Consistent routing
Weighted: Based on capacity
Interview Tips
Do's ✅
- Ask clarifying questions
- Start with high-level design
- Discuss trade-offs
- Consider scalability
- Mention monitoring
Don'ts ❌
- Jump into implementation
- Ignore requirements
- Over-engineer
- Forget about failures
- Skip bottleneck analysis
Preparation Resources
Practice Platforms
- LeetCode System Design
- Educative.io
- System Design Primer (GitHub)
- Grokking System Design
Books
- Designing Data-Intensive Applications
- System Design Interview (Alex Xu)
- Web Scalability for Startup Engineers
YouTube Channels
- Gaurav Sen
- Tech Dummies
- System Design Interview
Conclusion
Key Takeaways:
- Master the framework (RADIO)
- Practice common patterns
- Understand trade-offs
- Think about scale
- Communicate clearly
Remember: System design interviews test your ability to:
- Break down complex problems
- Make informed decisions
- Consider trade-offs
- Design scalable systems
- Communicate effectively
Good luck with your interviews! 🚀