System Design Interview Kickstart: Architecture Flows & Fundamentals
1. Approach to System Design Questions
Step-by-Step Framework
1. Clarify Requirements
2. Functional: What should the system do?
3. Non-functional: Scale, availability, latency, etc.
4. Constraints: Users, QPS, storage, etc.
5. Define Scope
6. MVP first, then extended features (e.g., for a chat app: text messaging before voice/video)
7. High-Level Architecture
8. Components involved: Client, Load Balancer, Application Servers, Database, Cache, etc.
9. Component Design
10. APIs, databases, messaging queues, file storage
11. Bottlenecks & Trade-offs
12. Partitioning, sharding, eventual consistency, CAP theorem
13. Scaling Strategies
14. Load balancing, caching, database sharding, rate limiting, CDN
15. Failure Handling & Observability
16. Redundancy, retries, monitoring, alerts, logging
2. Key Architectural Flows
2.1 URL Shortener (e.g., Bitly)
Components: - Client - Load Balancer - Application Server - Cache (Redis) - Relational DB (e.g., MySQL)
1
Flow: 1. Client sends long URL to service. 2. Server validates and generates short hash (base62 of auto-
increment or UUID). 3. Store mapping in DB, and optionally cache. 4. On access, lookup hash in cache ->
fallback to DB.
2.2 Real-time Chat App
Components: - Mobile/Web Client - WebSocket Gateway - Message Broker (Kafka/RabbitMQ) - Chat Service -
Database (MongoDB/Cassandra)
Flow: 1. Client connects via WebSocket. 2. Messages are pushed to the broker. 3. Consumers write to DB
and broadcast to other clients. 4. Offline messages stored in DB.
2.3 Rate Limiter
Approaches: Token Bucket / Leaky Bucket / Sliding Window Architecture: - API Gateway with rate limiting
middleware (Redis-based)
Flow (Sliding Window): 1. On request, check Redis for user timestamps. 2. If within limit, allow and store
timestamp. 3. Else, reject with 429.
3. Common Components Explained
Load Balancer
• Evenly distributes traffic (Round Robin, Least Connections, etc.)
• Health checks for upstream servers
Cache (Redis/Memcached)
• Reduces DB load, serves frequent reads
• Use TTL for expiring data
Message Queue (Kafka, RabbitMQ)
• Async processing, decoupling services
• Ensures durability and ordering (Kafka)
Database Scaling
• Vertical: Add resources to server
• Horizontal: Partition/shard data
• Read replicas for load
CDN (Content Delivery Network)
• Edge servers cache static content
• Reduces latency for global users
2
4. Pro Tips
• Always define traffic & scale: QPS, DAUs, data size
• Use diagrams to show flows
• Talk through trade-offs and constraints
• Practice common questions: YouTube, Instagram, WhatsApp, etc.
Let me know if you want architecture diagrams visualized or topics like data partitioning, consistency
trade-offs, or microservices vs monolith added next.